forcedotcom / lwc-dev-server-feedback

LWC Local Development
BSD 3-Clause "New" or "Revised" License
45 stars 10 forks source link

Local dev server throws error `Unable to expose method "then"` on startup. #57

Open muenzpraeger opened 4 years ago

muenzpraeger commented 4 years ago

Describe the bug On startup the plugin throws this error:

Error: Unable to expose method "then"
    at Object.plumbing.exposePromiseMethod (~/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-core/lib/plumbing.js:140:19)
    at module.exports (~/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-core/configure/request2.js:57:83)
    at Object.<anonymous> (~/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-native/lib/rp.js:15:1)
    at Module._compile (~/.local/share/sfdx/client/7.46.3-4cf515d568/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at LazyLoader.loadModule (~/.local/share/sfdx/client/7.46.3-4cf515d568/node_modules/@salesforce/lazy-require/lib/LazyLoader.js:139:21)
    at Function._load (~/.local/share/sfdx/client/7.46.3-4cf515d568/node_modules/@salesforce/lazy-require/lib/LazyLoader.js:115:29)

To Reproduce

  1. Run sfdx force:lightning:lwc:start
  2. Error occurs

Expected behavior It should start. ;-)

Additional context List of DX plugins that are installed.

@muenzpraeger/sfdx-plugin 0.4.0
@oclif/plugin-autocomplete 0.1.5
@oclif/plugin-commands 1.2.3 (core)
@oclif/plugin-not-found 1.2.3 (core)
@oclif/plugin-plugins 1.7.9 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/lwc-dev-server 1.0.10
├─ @oclif/plugin-help 2.2.1
└─ @oclif/plugin-update 1.3.9

@salesforce/sfdx-diff 0.0.6
@salesforce/sfdx-trust 3.0.7 (core)
analytics 1.7.0 (core)
evergreen 0.13.1
└─ evergreen-build 0.4.2

generator 1.1.2 (core)
salesforce-alm 48.5.0
salesforcedx 48.3.1
├─ @salesforce/sfdx-plugin-lwc-test 0.1.5
└─ salesforcedx-templates 48.4.0

sfdx-cli 7.46.3 (core)
KrisGraySFDC commented 4 years ago

This happens when you try to start it against lwc-recipies as well?

muenzpraeger commented 4 years ago

Yup, happens with lwc-recipes as well.

muenzpraeger commented 4 years ago

Ok, so the issue happens with return this.loadModule(filename, realLoad, request, parent, isMain); within the LazyLoader for /Users/rwinkelmeyer/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-native/lib/rp.js

KrisGraySFDC commented 4 years ago

Thanks Rene, thats good we can work on upgrading that.

Wonder if everyones having this same issue?

muenzpraeger commented 4 years ago

@KrisGraySFDC I unblocked myself (for now), by upgrading the dependency myself. It’s not beautiful, but it works.

stale[bot] commented 4 years ago

This issue has been automatically marked as type:bug-p3 because it has not had recent activity.

git2gus[bot] commented 4 years ago

This issue has been linked to a new work item: W-7356676

xyc commented 4 years ago

@KrisGraySFDC Has the dependencies already been updated? Looks like this is not reproducible

KrisGraySFDC commented 4 years ago

I thought this was a transitive dependency, and thus we'd have to trace it back. By upgrading to the latest lwc you should have upgraded it.

stale[bot] commented 4 years ago

This issue has been automatically marked as type:bug-p3 because it has not had recent activity.

git2gus[bot] commented 4 years ago

This issue has been linked to a new work item: W-7651084

lcampos commented 4 years ago

The fix for this was released as part of version 2.1.0. Thanks for logging this.

pbattisson commented 4 years ago

Sadly I still seem to be getting this on 2.1.1:

sfdx force:lightning:lwc:start
Error: Unable to expose method "then"
    at Object.plumbing.exposePromiseMethod (~/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-core/lib/plumbing.js:140:19)
    at module.exports (~/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-core/configure/request2.js:57:83)
    at Object.<anonymous> (~/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-native/lib/rp.js:15:1)
    at Module._compile (~/.local/share/sfdx/client/7.62.1-309fe6da17/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at LazyLoader.loadModule (~/.local/share/sfdx/client/7.62.1-309fe6da17/node_modules/@salesforce/lazy-require/lib/LazyLoader.js:139:21)
    at Function._load (~/.local/share/sfdx/client/7.62.1-309fe6da17/node_modules/@salesforce/lazy-require/lib/LazyLoader.js:115:29)
08:42:21.692 sfdx force:lightning:lwc:start

Updated sfdx and here are the versions of things I am running

sfdx plugins
@salesforce/lwc-dev-server 2.1.1
├─ @oclif/plugin-help 2.2.1
└─ @oclif/plugin-update 1.3.9
jag-j commented 4 years ago

@pbattisson - I'm looking to fix this issue, but still trying to repro this locally. @muenzpraeger - Can you elaborate on "I unblocked myself (for now), by upgrading the dependency myself". Which dependency did you upgrade and the version?

muenzpraeger commented 4 years ago

That's looong time ago. If I recall correctly I upgraded jsdom.

stale[bot] commented 4 years ago

This issue has been automatically marked as type:bug-p3 because it has not had recent activity.

ben-zhang-at-salesforce commented 4 years ago

I run into same problem, "sfdx-cli/7.69.0-c7be45ae22 darwin-x64 node-v12.18.3" when run 'sfdx force:lightning:lwc:start' at Object.plumbing.exposePromiseMethod (~/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-core/lib/plumbing.js:140:19) at module.exports (~/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-core/configure/request2.js:57:83) at Object. (~/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-native/lib/rp.js:15:1) at Module._compile (~/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) at LazyLoader.loadModule (~/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@salesforce/lazy-require/lib/LazyLoader.js:139:21) at Function._load (~/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@salesforce/lazy-require/lib/LazyLoader.js:115:29)

mcrdjr commented 4 years ago

I've been getting this same error also recently. The only thing I can think of that I've done is to install Jest so I could test my components. I have no test failures on the components and they install and run fine in my org.

Using both commands work fine. sfdx force:lightning:lwc:test:run and npx jest --coverage

Plugin @salesforce/lwc-dev-server 2.5.1 ├─ @oclif/plugin-update 1.3.9 └─ @oclif/plugin-help 2.2.3

VERSION sfdx-cli/7.69.0-c7be45ae22 darwin-x64 node-v12.18.3

10:47:45.554 sfdx force:lightning:lwc:start Error: Unable to expose method "then" at Object.plumbing.exposePromiseMethod (~/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-core/lib/plumbing.js:140:19) at module.exports (~/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-core/configure/request2.js:57:83) at Object. (~/.local/share/sfdx/node_modules/jsdom/node_modules/request-promise-native/lib/rp.js:15:1) at Module._compile (~/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) at LazyLoader.loadModule (~/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@salesforce/lazy-require/lib/LazyLoader.js:139:21) at Function._load (~/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@salesforce/lazy-require/lib/LazyLoader.js:115:29) 10:47:50.589 sfdx force:lightning:lwc:start ended with exit code 1

Error: The local development server was not able to start.

mcrdjr commented 4 years ago

Okay, after trying all kinds of things yesterday and today, I looked at that .local/share/sfdx folder I removed the sfdx folder and dev server still did not start, which is what I guessed would happen. I then installed the plugin again sfdx plugins:install @salesforce/lwc-dev-server and the local dev server is now working again. yippie-kay-yay!

luke-rallyhc commented 4 years ago

I just started recently facing this issue. No real changes on my end. I didn't use local development server during the weekend and I came back and now it won't start up. It has been 4 days of it now working.

I've tried updating sfdx plugins as well.

stale[bot] commented 4 years ago

This issue has been automatically marked as type:bug-p3 because it has not had recent activity.

harshitsinghal commented 4 years ago

As of today, I am facing this issue as well. Below are the commands I run on VS Code:

Command 1: sfdx plugins:update Command 1 Output: warning "@salesforce/lwc-dev-server > @rollup/plugin-alias@3.1.1" has unmet peer dependency "rollup@^1.20.0||^2.0.0". warning "@salesforce/lwc-dev-server > request-promise-native@1.0.9" has unmet peer dependency "request@^2.34". warning "@salesforce/lwc-dev-server > request-promise-native > request-promise-core@1.1.4" has unmet peer dependency "request@^2.34". sfdx-cli: Updating plugins... done

Command 2: sfdx force:lightning:lwc:start Command 2 Output:
Error: Unable to expose method "then"

I have just created a blank project in VS Code and authorised a new scratch org. Then I try and start the Local Dev server and see this error. Below is the snapshot from my VS Code: image

Meanwhile, I will manage with org based LWC development but would like to receive the fix once it is available.

Thanks!

Thanks!

stale[bot] commented 3 years ago

This issue has been automatically marked as type:bug-p3 because it has not had recent activity.

rajendrasnagar commented 3 years ago

It was working few weeks back, but again after update it is not working. image

More Details: SFDX --version: sfdx-cli/7.74.1 win32-x64 node-v10.16.3 @salesforce/lwc-dev-server 2.5.1 ├─ @oclif/plugin-help 2.2.1 └─ @oclif/plugin-update 1.3.9 sfdx-dependency-plugin 2.0.1

rajendrasnagar commented 3 years ago

Is there any timeline for this to get fixed. Any workaround ?

rajendrasnagar commented 3 years ago

Commenting, Just to keep this open. Still I am facing this issue & not able to get any workaround. image

xyc commented 3 years ago

@rajendrasnagar Could you try setting the env variable: SFDX_LAZY_LOAD_MODULES=false? For example: SFDX_LAZY_LOAD_MODULES=false sfdx force:lightning:lwc:start

rajendrasnagar commented 3 years ago

Hi @xyc , setting this variable doesn't work for me. However, FYI, I was previously using npm based cli. I uninstalled it and tried with standalone .exe. It didn't worked. Then, i uninstalled local dev plugins & re-installed it. Now, its working.

scottmcclung commented 3 years ago

@rajendrasnagar Could you try setting the env variable: SFDX_LAZY_LOAD_MODULES=false? For example: SFDX_LAZY_LOAD_MODULES=false sfdx force:lightning:lwc:start

@xyc This did work for me.

geekyakshay commented 3 years ago

Uninstalling the local dev plugin and re-installing it worked for me too. Thanks to @rajendrasnagar

stale[bot] commented 3 years ago

This issue has been automatically marked as type:bug-p3 because it has not had recent activity.

AllanOricil commented 3 years ago

I had the same issue. Tried to fix with sfdx plugins:update and it did not work. Then I uninstalled the plugin and installed it again and now everything is working fine.

stale[bot] commented 3 years ago

This issue has been automatically marked as type:bug-p3 because it has not had recent activity.