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

When running in WSL emulator does not properly detect lack of 'java' executable #1713

Closed
barnu5 opened this issue Oct 10, 2019 · 7 comments · Fixed by #1717
Closed

When running in WSL emulator does not properly detect lack of 'java' executable #1713

barnu5 opened this issue Oct 10, 2019 · 7 comments · Fixed by #1717

Comments

@barnu5
Copy link

barnu5 commented Oct 10, 2019

Hi Firebase team,

I've not had success trying to get emulators working in WSL.

The recent update (#1458) fixed the port was not active within 3000ms issue.

End goal is to have console.log() showing function output in the command prompt.

Here are the details:

[REQUIRED] Environment info

firebase-tools: 7.5.0

Platform: Windows/WSL

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

Test commands pasted. The issue happens reliably everytime, emulators are unable to start.

[REQUIRED] Expected behavior

Emulators should start, firebase function output viewable in command prompt.

[REQUIRED] Actual behavior

firebase-debug.log
[debug] [2019-10-10T21:19:08.690Z] ----------------------------------------------------------------------
[debug] [2019-10-10T21:19:08.693Z] Command: /home/standard/.nvm/versions/node/v10.16.0/bin/node /home/standard/.nvm/versions/node/v10.16.0/bin/firebase emulators:start
[debug] [2019-10-10T21:19:08.693Z] CLI Version: 7.5.0
[debug] [2019-10-10T21:19:08.693Z] Platform: linux
[debug] [2019-10-10T21:19:08.693Z] Node Version: v10.16.0
[debug] [2019-10-10T21:19:09.522Z] Time: Fri Oct 11 2019 07:19:08 GMT+1000 (GMT+10:00)
[debug] [2019-10-10T21:19:09.522Z] ----------------------------------------------------------------------
[debug]
[debug] [2019-10-10T21:19:09.537Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2019-10-10T21:19:09.539Z] > authorizing via signed-in user
[info] i Starting emulators: ["functions","firestore","hosting"]
[warn] ⚠ Your requested "node" version "8" doesn't match your global version "10"
[info] ✔ functions: Emulator started at http://localhost:5001
[info] i firestore: Serving ALL traffic (including WebChannel) on http://localhost:8080
[warn] ⚠ firestore: Support for WebChannel on a separate port (8081) is DEPRECATED and will go away soon. Please use port above instead.
[debug] [2019-10-10T21:19:09.939Z] Ignoring unsupported arg: projectId
[debug] [2019-10-10T21:19:09.939Z] Ignoring unsupported arg: auto_download
[debug] [2019-10-10T21:19:09.939Z] Starting emulator firestore with command {"binary":"java","args":["-Duser.language=en","-jar","/home/DIR_NAME/standard/.cache/firebase/emulators/cloud-firestore-emulator-v1.9.0.jar","--host","localhost","--port",8080,"--rules","/mnt/c/Users/Standard/Documents/GitHub/DIR/firestore.rules","--functions_emulator","localhost:5001","--webchannel_port",8081],"optionalArgs":["port","webchannel_port","host","rules","functions_emulator"]}
[info] i firestore: Emulator logging to firestore-debug.log
[info] i Shutting down emulators.
[info] i Stopping functions emulator
[debug] [2019-10-10T21:19:09.999Z] Error: spawn java EACCES
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
[error]
[error] Error: An unexpected error has occurred.

Also, running firebase serve:
➜ DIR_NAMEgit:(master) ✗ firebase serve --only functions [11/10/19| 8:19AM]
⚠ Your requested "node" version "8" doesn't match your global version "10"
✔ functions: Emulator started at http://localhost:5000
i functions: Watching "/mnt/c/Users/Standard/Documents/GitHub/DIR_NAME/functions" for Cloud Functions...


git:(master) ✗ firebase emulators:start --debug [11/10/19| 8:30AM]
[2019-10-10T21:31:51.586Z] ----------------------------------------------------------------------
[2019-10-10T21:31:51.594Z] Command: /home/standard/.nvm/versions/node/v10.16.0/bin/node /home/standard/.nvm/versions/node/v10.16.0/bin/firebase emulators:start --debug
[2019-10-10T21:31:51.598Z] CLI Version: 7.5.0
[2019-10-10T21:31:51.599Z] Platform: linux
[2019-10-10T21:31:51.600Z] Node Version: v10.16.0
[2019-10-10T21:31:52.440Z] Time: Fri Oct 11 2019 07:31:51 GMT+1000 (GMT+10:00)
[2019-10-10T21:31:52.444Z] ----------------------------------------------------------------------

[2019-10-10T21:31:52.464Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2019-10-10T21:31:52.472Z] > authorizing via signed-in user
i Starting emulators: ["functions","firestore","hosting"]
⚠ Your requested "node" version "8" doesn't match your global version "10"
✔ functions: Emulator started at http://localhost:5001
i firestore: Serving ALL traffic (including WebChannel) on http://localhost:8080
⚠ firestore: Support for WebChannel on a separate port (8081) is DEPRECATED and will go away soon. Please use port above instead.
[2019-10-10T21:31:52.848Z] Ignoring unsupported arg: projectId
[2019-10-10T21:31:52.850Z] Ignoring unsupported arg: auto_download
[2019-10-10T21:31:52.851Z] Starting emulator firestore with command {"binary":"java","args":["-Duser.language=en","-jar","/home/standard/.cache/firebase/emulators/cloud-firestore-emulator-v1.9.0.jar","--host","localhost","--port",8080,"--rules","/mnt/c/Users/Standard/Documents/GitHub/DIR_NAME/firestore.rules","--functions_emulator","localhost:5001","--webchannel_port",8081],"optionalArgs":["port","webchannel_port","host","rules","functions_emulator"]}
i firestore: Emulator logging to firestore-debug.log
i Shutting down emulators.
i Stopping functions emulator
[2019-10-10T21:31:52.924Z] Error: spawn java EACCES
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)

Error: An unexpected error has occurred.

@google-oss-bot
Copy link
Contributor

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

@samtstern
Copy link
Contributor

@barnu5 do you have java installed? Can you run java -version and tell me what version you have?

@barnu5
Copy link
Author

barnu5 commented Oct 10, 2019

Thanks @samtstern for all your help.

I have now installed java separately, following this: https://wiki.jmk.hu/wiki/Install_Java_Development_Kit_on_Windows_Subsystem_for_Linux

I am now seeing hosting logging in the command prompt like: `127.0.0.1 - - [10/Oct/2019:22:14:40 +0000] "GET /static/media/image.f098d4b4.svg HTTP/1.1" 200 1783 "http://localhost:5000/app" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"

Can you tell me, how can I see firebase function logging output in the console?

@samtstern
Copy link
Contributor

@barnu5 if your function calls console.log() you should see that output in the console when the function runs. If you're not seeing that, please file a new issue for that.

@samtstern samtstern changed the title Unable to get emulators working on WSL When running in WSL emulator does not properly detect lack of 'java' executable Oct 10, 2019
@samtstern
Copy link
Contributor

I renamed this issue because we should be telling you when you don't have java but clearly we are not.

@barnu5
Copy link
Author

barnu5 commented Oct 10, 2019

@samtstern In that case, you've just closed another one! I'll submit a new issue for the logging!

@barnu5 barnu5 closed this as completed Oct 10, 2019
@samtstern samtstern reopened this Oct 11, 2019
@samtstern
Copy link
Contributor

I want to leave this open so we can better detect this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants