Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BLOCKER] Runtime Error in WP-Desktop: "TypeError: ...default is not a function..." #40789

Closed
nsakaimbo opened this issue Apr 4, 2020 · 4 comments
Labels
[Feature] WordPress Desktop App Features and improvements related to the WordPress Desktop App. [Pri] BLOCKER [Type] Bug

Comments

@nsakaimbo
Copy link
Contributor

nsakaimbo commented Apr 4, 2020

Attempting to run WP Desktop with the latest Calypso master results in a runtime error: TypeError: ...default is not a function.... I tried debugging this (see my notes below) but haven't been successful and would appreciate some help.

Steps to reproduce

Update wp-desktop submodule with latest Calypso. Build and run the application.

Screenshots

desktop-runtime-error

Browser / OS version

macOS 10.15.3

Attempts to Debug

I tried to isolate the root cause but haven't had much luck. Perhaps these notes might be useful anyway.

Last known good SHA: 3af7284
First known bad SHA: e9cc8c0

  • I tried to perform a git bisect bisect between the aforementioned commits (with a full npm ci and rebuild at each step), but got inconsistent results (not sure why, I must be missing something)
  • The error does not seem to occur in developer mode, only in production (where NODE_ENV=production). So perhaps webpack related?
  • FWIW, the version of Electron in the desktop app is running Node v10
  • Some searching on the web indicates this might be related to the inability to resolve export syntax somewhere in the code
  • I also found this discussion on Github regarding the use of allowSyntheticDefaultImports setting. I see we use this in the Calypso config - do we need to apply this in Desktop as well?

Basically when you have a library compiling with tsconfig allowSyntheticDefaultImports and then a consuming application that does not use that setting, we got that error.

Not sure if any of the above notes are helpful but figured it wouldn't hurt to share.

@nsakaimbo nsakaimbo added [Type] Bug [Pri] BLOCKER [Feature] WordPress Desktop App Features and improvements related to the WordPress Desktop App. labels Apr 4, 2020
@sirbrillig
Copy link
Member

It's a long shot but this PR might be worth testing to see if it helps (by removing a test helper that imported a polyfill library): #40596

@nsakaimbo
Copy link
Contributor Author

nsakaimbo commented Apr 7, 2020

Thanks, @sirbrillig - I tried building a desktop branch with that PR, but unfortunately the runtime error still persists:

https://github.com/Automattic/wp-desktop/tree/test-calypso-wip-pr

Still a useful exercise in ruling out the imported polyfill library, at least.

@nsakaimbo
Copy link
Contributor Author

Update:

I believe I've been able to isolate the SHA that introduced the runtime error.

I tested a series of Calypso commits in a temporary branch https://github.com/Automattic/wp-desktop/commits/test-calypso-runtime-error in the desktop repo, and the error seems to have been introduced in SHA 8528342. I tested this SHA a couple of times to be sure, and also confirmed that the SHA immediately prior (d95191c) works as expected.

However nothing obvious jumps out to me with respect to the diff in 8528342, although I see that some webpack configuration items were changed.

@jsnajdr Wondering if you might have any educated guesses here?

@nsakaimbo
Copy link
Contributor Author

Closing this issue as it has been address by #40925 and did not auto-close for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] WordPress Desktop App Features and improvements related to the WordPress Desktop App. [Pri] BLOCKER [Type] Bug
Projects
None yet
Development

No branches or pull requests

2 participants