firebase-tools: firestore emulator on wsl2 does not work, results in ERR_CONNECTION_REFUSED
[REQUIRED] Environment info
firebase-tools:8.4.1
Platform: wsl2 with Ubuntu-18.04
[REQUIRED] Test case
Start emulator firebase emulators:start --only firestore
Navigate to http://127.0.0.1:4000/firestore
Try to write in the database or simply check console
[REQUIRED] Steps to reproduce
Brand new project firebase init
Select emulators and firestore
firebase init to get firestore files firestore.rules
firestore.indexes.json
Follow test case above - go to url and write to database
[REQUIRED] Expected behavior
Should be able to write and read collection through emulator UI
[REQUIRED] Actual behavior
No changes are made to firestore, and receive error in console
xhrio.js:622 POST http://localhost:8080/google.firestore.v1.Firestore/Write/channel?database=projects%2Fmyproj%2Fdatabases%2F(default)&VER=8&RID=78563&CVER=22&X-HTTP-Session-Id=gsessionid&%24httpHeaders=Authorization%3ABearer%20owner%0D%0AX-Goog-Api-Client%3Agl-js%2F%20fire%2F7.14.3%0D%0A&zx=u51ejgj9v8vq&t=1 net::ERR_CONNECTION_REFUSED
firebase emulators:start --only firestore --debug
[2020-06-05T19:52:33.335Z] > 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"]
[2020-06-05T19:52:33.336Z] > authorizing via signed-in user
i emulators: Starting emulators: firestore {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: firestore"}}
[2020-06-05T19:52:33.350Z] [hub] writing locator at /tmp/hub-leotestproj2.json
[2020-06-05T19:52:33.372Z] Ignoring unsupported arg: projectId {"metadata":{"emulator":{"name":"firestore"},"message":"Ignoring unsupported arg: projectId"}}
[2020-06-05T19:52:33.372Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"firestore"},"message":"Ignoring unsupported arg: auto_download"}}
[2020-06-05T19:52:33.372Z] Starting Firestore Emulator with command {"binary":"java","args":["-Duser.language=en","-jar","/home/leo/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.4.jar","--host","localhost","--port",8080,"--rules","/home/leo/projects/practice/firebase-proj/firestore.rules"],"optionalArgs":["port","webchannel_port","host","rules","functions_emulator","seed_from_export"],"joinArgs":false} {"metadata":{"emulator":{"name":"firestore"},"message":"Starting Firestore Emulator with command {\"binary\":\"java\",\"args\":[\"-Duser.language=en\",\"-jar\",\"/home/leo/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.4.jar\",\"--host\",\"localhost\",\"--port\",8080,\"--rules\",\"/home/leo/projects/practice/firebase-proj/firestore.rules\"],\"optionalArgs\":[\"port\",\"webchannel_port\",\"host\",\"rules\",\"functions_emulator\",\"seed_from_export\"],\"joinArgs\":false}"}}
i firestore: Firestore Emulator logging to firestore-debug.log {"metadata":{"emulator":{"name":"firestore"},"message":"Firestore Emulator logging to \u001b[1mfirestore-debug.log\u001b[22m"}}
[2020-06-05T19:52:33.966Z] API endpoint: http://localhost:8080 {"metadata":{"emulator":{"name":"firestore"},"message":"API endpoint: http://localhost:8080"}}
[2020-06-05T19:52:33.966Z]
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:
export FIRESTORE_EMULATOR_HOST=localhost:8080
Dev App Server is now running.
{"metadata":{"emulator":{"name":"firestore"},"message":"\nIf you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:\n\n export FIRESTORE_EMULATOR_HOST=localhost:8080\n\nDev App Server is now running.\n\n"}}
[2020-06-05T19:52:34.138Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: auto_download"}}
[2020-06-05T19:52:34.138Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: port"}}
[2020-06-05T19:52:34.138Z] Starting Emulator UI with command {"binary":"node","args":["/home/leo/.cache/firebase/emulators/ui-v1.0.0/server.bundle.js"],"optionalArgs":[],"joinArgs":false} {"metadata":{"emulator":{"name":"ui"},"message":"Starting Emulator UI with command {\"binary\":\"node\",\"args\":[\"/home/leo/.cache/firebase/emulators/ui-v1.0.0/server.bundle.js\"],\"optionalArgs\":[],\"joinArgs\":false}"}}
i ui: Emulator UI logging to ui-debug.log {"metadata":{"emulator":{"name":"ui"},"message":"Emulator UI logging to \u001b[1mui-debug.log\u001b[22m"}}
[2020-06-05T19:52:34.254Z] Web / API server started at http://localhost:4000
{"metadata":{"emulator":{"name":"ui"},"message":"Web / API server started at http://localhost:4000\n"}}
┌───────────────────────────────────────────────────────────────────────┐
│ ✔ All emulators ready! View status and logs at http://localhost:4000 │
└───────────────────────────────────────────────────────────────────────┘
┌───────────┬────────────────┬─────────────────────────────────┐
│ Emulator │ Host:Port │ View in Emulator UI │
├───────────┼────────────────┼─────────────────────────────────┤
│ Firestore │ localhost:8080 │ http://localhost:4000/firestore │
└───────────┴────────────────┴─────────────────────────────────┘
Other reserved ports: 4400, 4500
Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
Note: I tried this on mac and it worked fine
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 17 (10 by maintainers)
I see two issues here:
127.0.0.1
when asked to listen onlocalhost
/127.0.0.1
on WSL.http://0.0.0.0:8080
when Firestore emulator is configured to listen on0.0.0.0
.Hopefully fixing 2. can give you a reasonable workaround, and we’d appreciate any help on root-causing or working around 1.
Thanks @yuchenshi , setting the host to
0.0.0.0
worked to be able to visit the emulator through my inet address. However I’m still unable to edit the firestore through the UI, this error appears now:@yuchenshi I’ve added new issue here: https://github.com/firebase/firebase-tools-ui/issues/332
@bartlomiejborzucki please open a new issue in the https://github.com/firebase/firebase-tools-ui repo with error messages from Firebase Emulator UI. For example, open Chrome DevTools on the UI (on the Firestore tab) and refresh to see what network requests fail and how. A screenshot can also be very helpful.
FYI, the fix for
0.0.0.0
went out with Firebase CLI v8.6.0. Please try that if you see issues with WSL withlocalhost
/127.0.0.1
.