-
Notifications
You must be signed in to change notification settings - Fork 958
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
[emulator:database] Long Polling fails when listening on 0.0.0.0 #2870
Comments
Also, the REST API of the emulator works perfectly with such a setup and one can reach the emulator on the forwarded
|
@yuchenshi or @crwilcox could you take a look at this? |
Could you mention WSL in the title of the issue? We have seen a number of issues specifically with WSL. I think firebase/firebase-tools-ui#332 captures most of it. Can you compare your configuration with the config at the end of the issue? |
@crwilcox thx for taking a look at the issue. I'm not sure it's a WSL issue because I do not run the emulator in the WSL. I use a docker image with the emulator and just start the docker image from Windows PC. I've just explicitly disabled WSL support on my laptop and reproduced the issue once again. I'm using the following {
"emulators": {
"database": {
"port": "54897",
"host": "0.0.0.0"
}
}
} I believe that's the one that is recommended as a workaround for WSL users, but again, I'm not running the emulator inside WSL and I'm not binding it to To run inside the container, I bind the emulator to My first request to the emulator goes to the I mentioned in the issue a repo with a test case and instructions on how to reproduce it: https://github.com/yuri-sergiichuk/firebase-rdb-docker-issue. I'm also going to do a manual test in Linux env tomorrow. |
I did a check on my Linux machine and what is interesting is that the emulator itself behaves differently while running on Windows and on Linux. On Windows, it (probably) downgraded my connection from web sockets to HTTP, and then a see the reported error behavior. While on Linux I do not see any HTTP connections to the emulator at all. It just works over the WS and works fine! Here's what going in the WS data frames: @crwilcox is there anything else I can grab to help to investigate the issue? It's really blocking us from switching to dockerized environments as the behavior is not consistent for all developers. |
FYI: the RTDB JS SDK has a feature where it remembers that connection fails over WebSocket and will fallback to long polling on subsequent tries. It does that by storing a flag in |
@yuchenshi you're a lifesaver! The web page indeed had a value in the local storage and as soon as I removed the entry my simplified example started working. I hope I'll be able to have this same fix applied to our main application and if so, it looks like there's no actual issue with the emulator (except that it may need to improve the long polling support). |
Works like a charm. In case you see your RTDB connection started working over HTTP while web sockets are expected, prune the local storage and you must be good to go! I'm closing the issue now. @crwilcox @yuchenshi thx for your help. I guess it might be a good idea to still investigate why the HTTP fallback is not working, but that's a different story. |
I've filed an internal bug tracking the redirect issue for the long polling request: b/175025844. |
@yuchenshi any updates on the internal bug? It is a bit annoying to clear the local storage flag each time :-( |
We don't have any updates to share at this point. Feel free to dig into why the WebSocket connection fails and open a new bug, and/or make deleting that storage key part of your setup code as a workaround. |
@yuri-sergiichuk localstorage trick does not work for me on linux vm , can you share your steps ? |
@nkshschdv, I just delete the value from the local storage from the Chrome Dev tools window: Have not incorporated some automated solution yet. |
[REQUIRED] Environment info
firebase-tools:
8.16.2
Platform: Alpine Linux Docker image.
[REQUIRED] Test case
The companion repository with a test example and detailed readme available here: https://github.com/yuri-sergiichuk/firebase-rdb-docker-issue.
[REQUIRED] Steps to reproduce
host
being set to0.0.0.0
.[REQUIRED] Expected behavior
You must be able to use the emulator via a forwarded port on localhost.
[REQUIRED] Actual behavior
The emulator handles the first
.lp?start
request but redirects the caller to0.0.0.0
and requests fail.Here's a dump of requests being sent to the emulator from the web page:
The text was updated successfully, but these errors were encountered: