Closed bartlomiejborzucki closed 4 years ago
From screenshots at https://github.com/firebase/firebase-tools-ui/issues/332#issuecomment-666603146 it appears that it is connecting fine in bash in WSL but not from PowerShell on Windows
There's no CLI repro steps in the OP, and I quit at what is no doubt a problem between keyboard and chair on firebase init
. Pasting firebase emulator:start
returns Error: emulator:start is not a Firebase command
(its emulators
). The json posted isn't well formed the ~brackets aren't matched~ Unexpected token ':'
. Attention span ended there.
4150 dupe?
Possibly #4851 with a side of #5298 based on firebase/firebase-tools-ui#332. It can probably be lit up absent #4150.
What does netstat -nl
return after firebase is started.
I've jumped though what appear to be plausible firebase
setup hoops, including registering a firebasehello
in the console along with firebase init
with option selections that also seem plausible.
$ curl -sL https://firebase.tools | bash
$ mkdir 5706 && cd 5706
$ firebase init
$ # select UI and firestore
Edited the resulting firebase.json
thus:
{
"emulators": {
"firestore": {
"port": 8080,
"host": "0.0.0.0"
},
"ui": {
"enabled": true,
"port": 8081,
"host": "0.0.0.0"
}
}
}
Then start:
The seems to take on 20180, WSL2, Ubuntu 20.04. From Edge and Powershell:
Looking at the netstat -nl
:
That tcp6 ::: 8080
is problematic on WSL2 ref #4851 (message), or at least used to be. #5298 went fixinbound in June, so whatever that was I won't be experiencing it on 20180.
General off-the-record guidance for 19041 would be to eschew localhost
. A better way to roll is use avahi-daemon
spiritually similar the sandstorm
thread #5368 (message). That will get you real IP address instead of localhost
, or typing the server address manually. TL;DR, sudo service dbus start
and sudo service avahi-daemon start
, after editing /etc/avahi/avahi-daemon.conf
. Looks like:
For accessing firebase
from elsewhere (LAN,WAN), that is perennial favorite #4150 as Hayden alluded. For web services like firebase
, a http proxy on the Windows side is one way to skin that cat. Some folks are using port forwarding. YRMV. HTH.
Hi, Thanks for the advice. I double-checked this issue https://github.com/microsoft/WSL/issues/4150 (and workaround) and it's really working! The first time, I checked the solution with a huge amount of likes - https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723 - and I failed. I got errors on PowerShell console :sweat_smile:. But the second time I used the script from this comment https://github.com/microsoft/WSL/issues/4150#issuecomment-667621988 and Firebase emulator has started to work properly :smiley: :smiley: :relieved:. I've added these ports to the following script:
$Ports =(22,80,443,8080,10000,3000,5000,5001,8081,4200,3128,4400,4500)
Thank you.
Thank you for additional advice related to using the localhost during development. Maybe the community should prepare a blog post or tutorial about working with the localhost on WSL2. There is a lot of information on GitHub about it but not in the same place :worried:.
For anyone else that ends up here, don't forget to update your firebase.json
files with:
{
...
"emulators": {
"firestore": {
"port": 8080,
"host": "0.0.0.0"
},
"ui": {
"enabled": true,
"port": 8081,
"host": "0.0.0.0"
}
}
}
The solution @bartlomiejborzucki mentions didn't work for me until I added this.
Can someone please summarize these instructions into one post for the workaround?
I'm pretty sure I've tried most of the suggestions and nothing thus far is working and I'm guessing different suggestions may interfere with one another.
Thus far I have
When I try to access the UI it simply says "Not Found"
Initial Error from the first Script here
PS C:\Users\tom\OneDrive\Documents\WSL Linux fix> .\wsl2-network.ps1
Remove-NetFireWallRule : No MSFT_NetFirewallRule objects found with property 'DisplayName' equal to 'WSL 2 Firewall
Unlock'. Verify the value of the property and retry.
At C:\Users\tom\OneDrive\Documents\WSL Linux fix\wsl2-network.ps1:32 char:1
+ Remove-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock';
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (WSL 2 Firewall Unlock:String) [Remove-NetFirewallRule], CimJobException
+ FullyQualifiedErrorId : CmdletizationQuery_NotFound_DisplayName,Remove-NetFirewallRule
WSL 2 is the only platform where firebase emulator is not working properly. I don't know where is the problem. I think that maybe it is related to WSL2 so I've added the following bug here. IMHO Firebase emulator is ok because I can use it on Linux Machine or MacOS machine without any problems.
Environment
windows 10 build 19041.388 WSL2 (ubuntu from Ms Store) firebase-tools:8.6.0
Steps to reproduce
more hints you can find here: https://github.com/firebase/firebase-tools/issues/2334 https://github.com/firebase/firebase-tools-ui/issues/332
Expected behavior
We should be able to connect to firestore backend emulator hosted on WLS2
Actual behavior
Connection is refused. Here I've added information about connection problem https://github.com/firebase/firebase-tools-ui/issues/332#issuecomment-666603146 In each case, I've changed firestore IP address (file firebase.json)