Firebase-tools: `firebase emulators:start` not working on WLS on Windows 10

Created on 2 Jul 2019  Â·  15Comments  Â·  Source: firebase/firebase-tools

[REQUIRED] Environment info


firebase-tools:
7.0.2


Platform:
WSL on Windows 10

[REQUIRED] Test case

An empty project with the auto-generated Cloud Functions boilerplate is enough to reproduce it.

[REQUIRED] Steps to reproduce

Run firebase emulators:start

[REQUIRED] Expected behavior

I should be able to use the local environment.

[REQUIRED] Actual behavior

It starts the local server at port 5001, if I open it in Chrome I get a { "status": "alive" } response, but after 30 seconds it shuts down by itself because of a "timeout".

✔  functions: Emulator started at http://localhost:5001
i  Shutting down emulators.
i  Stopping functions emulator

Error: TIMEOUT: Port 5001 was not active within 30000ms

The project works fine when deployed to Google Cloud. I tried to run it with sudo also.

If I visit the demo "hello world" endpoint I get an error saying the endpoint is not available.

I tried to run it with --debug but no additional information is displayed during the shutdown/timeout

emulator-suite

Most helpful comment

I was able to reproduce this bug at home on my personal machine (we don't have Windows at work) so it's definitely real! I didn't have time to start debugging but I will try that next.

All 15 comments

Reading this page:
https://docs.microsoft.com/en-us/windows/wsl/wsl2-ux-changes

It says:

In initial builds of the WSL 2 preview you will need to access network applications using an IP address and not using localhost

Then it goes on to say:

In the initial builds of the WSL 2 preview, you will need to access any Linux server from Windows using the IP address of your Linux distro, and any Windows server from Linux using the IP address of your host machine. This is something that is temporary, and very high on our priority list to fix.

So this is something that is new in WSL2 but also going to change before WSL2 is finalized, meaning that I don't think we should do anything within firebase-tools to accommodate this for now.

Thanks for reporting this @FezVrasta !

I'm not using WSL 2 tho, AFAIK I'm using version 1

@FezVrasta oh that's interesting, thanks for sharing! Assigning to @abeisgoat since he has a Windows setup and I don't.

Hi, any update on this? Running into the same problem.

cc @Karasuni

I'm seeing this issue on Windows 10 Build 18362 running WSL 1, not WSL 2.

Also the issue I reported is with firebase-tools 7.1.0 but does not occur with 7.0.2.

I've reproduced the same issue with Win 10 1903 (build 18362.239), WSL 1, firebase-tools 7.1.0 and 7.1.1. For now downgrading to 7.0.2 is fine as a workaround.

I have a new theory. In 7.1.0 we introduced a dependency on "chokidar" for
file watching which is a native module. Native modules can cause
os-specific issues. It's possible that is why 7.1.0+ stopped working on
WSL.

On Mon, Jul 22, 2019, 6:29 PM Rory Dungan notifications@github.com wrote:

I've reproduced the same issue with Win 10 1903 (build 18362.239), WSL 1,
firebase-tools 7.1.0 and 7.1.1. For now downgrading to 7.0.2 is fine as a
workaround.

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/1458?email_source=notifications&email_token=ACATB2V6AL7TXI23VUBFEFTQAZNHVA5CNFSM4H43MOYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2RUMAI#issuecomment-514016769,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACATB2UATJUGV3HCDY6MLO3QAZNHVANCNFSM4H43MOYA
.

I was able to reproduce this bug at home on my personal machine (we don't have Windows at work) so it's definitely real! I didn't have time to start debugging but I will try that next.

Just a clue.
Environment:
firebase-tools 7.1.0 or 7.2.0
Arch Linux
> node_modules/.bin/firebase serve --only functions terminates after timeout
> $HOME/.npm/bin/firebase serve --only functions doesn't terminate

So it only terminates if firebase-tools are installed locally. My npm config get prefix is $HOME/.npm so if I do npm i -g firebase-tools everything works ok, but it doesn't work from local node_modules in my project directory.

Issue persists with firebase-tools 7.3.0 on WSL 1.

Error: TIMEOUT: Port 5000 was not active within 30000ms
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ prod: `firebase serve --only functions`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the functions@ prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/simone/.npm/_logs/2019-09-02T09_24_45_392Z-debug.log

WSL version: 1
firebase --version: 7.3.0
Node.js version: 12.9.0
NPM version: 6.11.2
Windows 10 Pro 1903 build 18362.295 (Stable)
Linux 4.4.0-18362-Microsoft

Can confirm the issue persists on 7.4.0 as well.

Emulator is unusable on WSL due to this issue.

Doesn't work on actual Windows either! https://github.com/firebase/functions-samples/issues/572

Ok version 7.5.0 should work well for all you Windows Linux Subsystem users out there!

Thanks Sam. Working great for me now.

Was this page helpful?
0 / 5 - 0 ratings