Vscode-react-native: Cannot read property 'getCurrentUserAsync' of undefined

Created on 21 Jul 2019  ยท  10Comments  ยท  Source: microsoft/vscode-react-native

Issue

  1. I am unable to debug in exponent due to error "Cannot read property 'getCurrentUserAsync' of undefined".

Software versions

  • React-Native VS Code extension version: 0.10.2
  • VSCode version: 1.35.1
  • OS platform and version: Ubuntu 16.04, Linux x64 4.4.0-154-generic
  • NodeJS version: 10.2.0
  • React Native version: 0.59.8
  • Expo SDK version (include if relevant):33.0.0

Outputs (Include if relevant)

  • Output of the Debug Console (View -> Toggle Debug Console):
OS: linux x64
Adapter node: v10.2.0 x64
vscode-chrome-debug-core: 6.7.46
Could not debug. Cannot read property 'getCurrentUserAsync' of undefined
  • Output of the React-Native output channel (View -> Toggle Output -> Select React-Native in ListBox):
[Info] Making sure your project uses the correct dependencies for Expo. This may take a while...

Checking if this is Expo app......
[Info] Starting Packager

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                                                              โ”‚
โ”‚  Running Metro Bundler on port 8081.                                         โ”‚
โ”‚                                                                              โ”‚
โ”‚  Keep Metro running while developing on any JS projects. Feel free to        โ”‚
โ”‚  close this tab and run your own Metro instance if you prefer.               โ”‚
โ”‚                                                                              โ”‚
โ”‚  https://github.com/facebook/react-native                                    โ”‚
โ”‚                                                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Looking for JS files in
   /home/dj/Desktop/Myapp 

[Info] Packager started.

[Info] Prewarming bundle cache. This may take a while ...

[Info] Building and running application.

[Error] TypeError: Cannot read property 'getCurrentUserAsync' of undefined
  • Output of the Developer Tools console (Help -> Toggle Developer Tools -> Select Console tab):
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:238 [Extension Host] rejected promise not handled within 1 second: TypeError: Cannot read property 'getCurrentUserAsync' of undefined
t.log @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:238
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:238 [Extension Host] stack trace: TypeError: Cannot read property 'getCurrentUserAsync' of undefined
    at getPackage.then (/home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/src/extension/exponent/xdlInterface.js:62:33)
    at _fulfilled (/home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:834:54)
    at Promise.then.Q.nextTick.self.promiseDispatch.done (/home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:796:13)
    at /home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:857:14
    at runSingle (/home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:137:13)
    at flush (/home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)
t.log @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:238
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:1406   ERR Cannot read property 'getCurrentUserAsync' of undefined: TypeError: Cannot read property 'getCurrentUserAsync' of undefined
    at getPackage.then (/home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/src/extension/exponent/xdlInterface.js:62:33)
    at _fulfilled (/home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:834:54)
    at Promise.then.Q.nextTick.self.promiseDispatch.done (/home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:796:13)
    at /home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:857:14
    at runSingle (/home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:137:13)
    at flush (/home/dj/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2/node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:238 [Extension Host] (node:7564) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
t.log @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:238
expo external external-report

Most helpful comment

Hi guys, thanks for letting us know. It seems to be an @expo/xdl package regression: https://github.com/expo/expo-cli/issues/864. To workaround it simply reinstall @expo/xdl package in extension directory:

  • Open extension directory in terminal: cd YOUR_HOME_DIRECTORY/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2
  • Uninstall @expo/xdl: npm uni --no-save @expo/xdl
  • Install @expo/[email protected]: npm i --no-save @expo/[email protected]

When the original issue will be resolved and expo will release a patch, just reinstall the extension and problem will go away automatically.

All 10 comments

Same problem occurs with the configuration below :

VSCODE Version: 1.36.1
React-Native VS Code extension version: 0.10.2
Node.js: 10.15.1
OS: Win32 x64
Expo: 3.0.2

Update : Reverting back to 0.10.0 didn't solve the problem. Other IDE functions are working properly

Hi guys, thanks for letting us know. It seems to be an @expo/xdl package regression: https://github.com/expo/expo-cli/issues/864. To workaround it simply reinstall @expo/xdl package in extension directory:

  • Open extension directory in terminal: cd YOUR_HOME_DIRECTORY/.vscode/extensions/msjsdiag.vscode-react-native-0.10.2
  • Uninstall @expo/xdl: npm uni --no-save @expo/xdl
  • Install @expo/[email protected]: npm i --no-save @expo/[email protected]

When the original issue will be resolved and expo will release a patch, just reinstall the extension and problem will go away automatically.

Thanks, @ruslan-bikkinin, it worked for me.

thanks @ruslan-bikkinin , that worked like a charm.

Thanks, @ruslan-bikkinin, it worked. You saved my day.

thanks, helped a lot

it really worked for me!

@ruslan-bikkinin answer works, but you will need repeat the process if the vscode-react-native gets updated, mine now is msjsdiag.vscode-react-native-0.11.0

@jaikme unfortunately, yes. We can't do much about it because this is Expo issue. If you want to get it resolved quicker, I'd suggest to go to the issue page and vote for it/leave a comment.

So, I apply the @expo/xdl downgrade workaround suggested by @ruslan-bikkinin above, which gets rid of the get "Cannot read property 'getCurrentUserAsync' of undefined" and everything appears to be good. However, when I try to run the app in my android Expo client app, I get a message that the "Packager not running at...." and it all comes to a stop. Running VS code1.38 with React Native Tools 0.11 but have also tried earlier versions with the same result. Any ideas anyone?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlexandreLouisnard picture AlexandreLouisnard  ยท  3Comments

yuki2006 picture yuki2006  ยท  5Comments

molant picture molant  ยท  3Comments

kralcifer-ms picture kralcifer-ms  ยท  4Comments

vsccarl picture vsccarl  ยท  3Comments