Open muzzah opened 8 months ago
A couple of additional notes to help with the issue
Ok so I seem to have solved the issue but not sure why its happening. I have the docker container associated with an internal dns host that is resolved by the Pihole located on the network. This DNS name is not resolvable publicly. If I access the emulator UI using the IP address directly in the browser, the Database Viewer works as expected and displays the data. If I use the hostname for somereason the Database viewer page starts requesting 0.0.0.0 again. Not sure why this is happening. If I shell into the docker container and use nslookup, the hostname resolves to the Linux VM running the container.
Does the emulator use its own DNS resolver and ignore the hosts dns settings by any chance?
As a side note, I am also seeing similaer behaviour ion the flutterfire android client library for the realtime database
D/Connection( 505): conn_2 - Opening a connection
D/WebSocket( 505): ws_2 - WebSocket error.
D/WebSocket( 505): com.google.firebase.database.tubesock.WebSocketException: error while creating socket to ws://0.0.0.0:5002/.ws?ns=canvas-advice-333009-default-rtdb&v=5&ls=up1KgIKErjlxgIgM0EQ2wg4r98LiNTYH
D/WebSocket( 505): at com.google.firebase.database.tubesock.WebSocket.createSocket(WebSocket.java:301)
D/WebSocket( 505): at com.google.firebase.database.tubesock.WebSocket.runReader(WebSocket.java:360)
D/WebSocket( 505): at com.google.firebase.database.tubesock.WebSocket.access$000(WebSocket.java:47)
D/WebSocket( 505): at com.google.firebase.database.tubesock.WebSocket$2.run(WebSocket.java:143)
D/WebSocket( 505): at java.lang.Thread.run(Thread.java:764)
D/WebSocket( 505): Caused by: java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 5002) from /:: (port 35356): connect failed: ECONNREFUSED (Connection refused)
D/WebSocket( 505): at libcore.io.IoBridge.connect(IoBridge.java:138)
D/WebSocket( 505): at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:129)
D/WebSocket( 505): at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:356)
D/WebSocket( 505): at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:198)
D/WebSocket( 505): at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
D/WebSocket( 505): at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:356)
D/WebSocket( 505): at java.net.Socket.connect(Socket.java:616)
D/WebSocket( 505): at java.net.Socket.connect(Socket.java:565)
D/WebSocket( 505): at java.net.Socket.<init>(Socket.java:445)
D/WebSocket( 505): at java.net.Socket.<init>(Socket.java:217)
D/WebSocket( 505): at com.google.firebase.database.tubesock.WebSocket.createSocket(WebSocket.java:297)
D/WebSocket( 505): ... 4 more
D/WebSocket( 505): Caused by: android.system.ErrnoException: connect failed: ECONNREFUSED (Connection refused)
D/WebSocket( 505): at libcore.io.Linux.connect(Native Method)
D/WebSocket( 505): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:126)
D/WebSocket( 505): at libcore.io.IoBridge.connectErrno(IoBridge.java:152)
D/WebSocket( 505): at libcore.io.IoBridge.connect(IoBridge.java:130)
D/WebSocket( 505): ... 14 more
D/WebSocket( 505): ws_2 - closing itself
Some furthe debugging from the realtime database client running on an Android emulator
D/PersistentConnection( 5482): pc_0 - Trying to fetch auth token
D/PersistentConnection( 5482): pc_0 - Trying to fetch app check token
D/PersistentConnection( 5482): pc_0 - Successfully fetched token, opening connection
D/Connection( 5482): conn_0 - Opening a connection
D/WebSocket( 5482): ws_0 - websocket opened
D/WebSocket( 5482): ws_0 - Reset keepAlive
D/WebSocket( 5482): ws_0 - ws message: {"t":"c","d":{"t":"h","d":{"ts":1708424459584,"v":"5","h":"0.0.0.0:5002","s":"ZofjtuoscNEU0SZf5kjxrKSpW3A3eBlP"}}}
D/WebSocket( 5482): ws_0 - Reset keepAlive. Remaining: 44998
D/WebSocket( 5482): ws_0 - HandleNewFrameCount: 1
D/WebSocket( 5482): ws_0 - handleIncomingFrame complete frame: {t=c, d={t=h, d={h=0.0.0.0:5002, s=ZofjtuoscNEU0SZf5kjxrKSpW3A3eBlP, v=5, ts=1708424459584}}}
D/Connection( 5482): conn_0 - Got control message: {t=h, d={h=0.0.0.0:5002, s=ZofjtuoscNEU0SZf5kjxrKSpW3A3eBlP, v=5, ts=1708424459584}}
D/Connection( 5482): conn_0 - realtime connection established
D/PersistentConnection( 5482): pc_0 - onReady
D/PersistentConnection( 5482): pc_0 - handling timestamp
D/PersistentConnection( 5482): pc_0 - Sending first connection stats
You can see the line output also related 0.0.0.0
D/WebSocket( 5482): ws_0 - ws message: {"t":"c","d":{"t":"h","d":{"ts":1708424459584,"v":"5","h":"0.0.0.0:5002","s":"ZofjtuoscNEU0SZf5kjxrKSpW3A3eBlP"}}}
[REQUIRED] Environment info
**firebase-tools: 13.3.0
Platform: Linux Docker Container
[REQUIRED] Test case
Create a docker container with the following Dockerfile
Use the following firebase.json file
Run container using the following command
[REQUIRED] Steps to reproduce
Access the above docker container firebase emulator UIfrom another machine through a local network
[REQUIRED] Expected behavior
The Realtime DB viewer should show the content of the Database
[REQUIRED] Actual behavior
The browser makes requests to 0.0.0.0 due to some config error in the firebase tooling and the realtime database page does not display the contents
Below is the umatrix extension showing the requests to 0.0.0.0
Below is the network requests from the browser dev tools window.
Below is the realtime database page showing tables but no content