firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.62k stars 3.95k forks source link

cloud_firestore: W/Firestore(22438): (25.0.0) [WriteStream]: (6d13a49) Stream closed with status: Status{code=UNAVAILABLE, description=Unable to resolve host firestore.googleapis.com, cause=java.lang.RuntimeException: java.net.UnknownHostException: Unable to resolve host "firestore.googleapis.com": No address associated with hostname #13218

Closed DaniyalDolare closed 1 week ago

DaniyalDolare commented 2 weeks ago

Is there an existing issue for this?

Which plugins are affected?

Database

Which platforms are affected?

Android

Description

Environment: Using windows for development and build and physical android device running on android 12 and 13. I am using cloud firestore in my flutter project. When I am online, everythings work good. I can create,read,update and delete data in my cloud firestore. But when I turn off my wifi and I am still in the app and tries to do any create,update,delete action, it gives this error: W/Firestore( 3295): at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:219) W/Firestore( 3295): ... 5 more W/Firestore( 3295): Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname) W/Firestore( 3295): at libcore.io.Linux.android_getaddrinfo(Native Method) W/Firestore( 3295): at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133) W/Firestore( 3295): at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:222) W/Firestore( 3295): at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133) W/Firestore( 3295): at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135) W/Firestore( 3295): ... 9 more W/Firestore( 3295): }.

When I close my app, turn off wifi, and open the app, it reads the data but I still cant do any write operation on the data.

Reproducing the issue

Setup a flutter project which uses cloud firestore. Turn on Wifi and perform crud operation Turn off Wifi and perform crud operation.

Firebase Core version

3.3.0

Flutter Version

3.22.2

Relevant Log Output

W/Firestore( 3295):     at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:219)
W/Firestore( 3295):     ... 5 more
W/Firestore( 3295): Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
W/Firestore( 3295):     at libcore.io.Linux.android_getaddrinfo(Native Method)
W/Firestore( 3295):     at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133)
W/Firestore( 3295):     at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:222)
W/Firestore( 3295):     at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133)
W/Firestore( 3295):     at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135)
W/Firestore( 3295):     ... 9 more
W/Firestore( 3295): }.
W/ManagedChannelImpl( 3295): [{0}] Failed to resolve name. status={1}

Flutter dependencies

Dart SDK 3.4.3 Flutter SDK 3.22.2 productivity_app 1.0.0+4

dependencies:

dev dependencies:

transitive dependencies:

Additional context and comments

It was working previously for me, but when I upgraded my projects dependencies like flutter sdk version, using latest version of all packages, I am getting issue,

SelaseKay commented 2 weeks ago

Hi @DaniyalDolare . Thanks for reporting. I am able to reproduce this issue. Can you recall the version it was working for previously?

DaniyalDolare commented 2 weeks ago

Hi @SelaseKay , The app is working now, there was some logic issue from my side. Now all crud operation is working in offline mode. But the error is still coming in the console log

W/Firestore( 6937): (25.0.0) [WatchStream]: (159d369) Stream closed with status: Status{code=UNAVAILABLE, description=null, cause=java.net.ConnectException: failed to connect to firestore.googleapis.com/142.250.183.74 (port 443) from /:: (port 0): connect failed: ENETUNREACH (Network is unreachable)
W/Firestore( 6937):     at libcore.io.IoBridge.connect(IoBridge.java:187)
W/Firestore( 6937):     at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
W/Firestore( 6937):     at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
W/Firestore( 6937):     at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
W/Firestore( 6937):     at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
W/Firestore( 6937):     at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
W/Firestore( 6937):     at java.net.Socket.connect(Socket.java:646)
W/Firestore( 6937):     at java.net.Socket.connect(Socket.java:595)
W/Firestore( 6937):     at java.net.Socket.<init>(Socket.java:475)
W/Firestore( 6937):     at java.net.Socket.<init>(Socket.java:275)
W/Firestore( 6937):     at javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:285)
W/Firestore( 6937):     at io.grpc.okhttp.OkHttpClientTransport$3.run(OkHttpClientTransport.java:535)
W/Firestore( 6937):     at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
W/Firestore( 6937):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
W/Firestore( 6937):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
W/Firestore( 6937):     at java.lang.Thread.run(Thread.java:1012)
W/Firestore( 6937): Caused by: android.system.ErrnoException: connect failed: ENETUNREACH (Network is unreachable)
W/Firestore( 6937):     at libcore.io.Linux.connect(Native Method)
W/Firestore( 6937):     at libcore.io.ForwardingOs.connect(ForwardingOs.java:201)
W/Firestore( 6937):     at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:158)
W/Firestore( 6937):     at libcore.io.ForwardingOs.connect(ForwardingOs.java:201)
W/Firestore( 6937):     at libcore.io.IoBridge.connectErrno(IoBridge.java:201)
W/Firestore( 6937):     at libcore.io.IoBridge.connect(IoBridge.java:179)
W/Firestore( 6937):     ... 15 more
W/Firestore( 6937): }.
W/ManagedChannelImpl( 6937): [{0}] Failed to resolve name. status={1}
SelaseKay commented 2 weeks ago

@DaniyalDolare , This issue is coming from the native Android sdk. It should be worth raising a report here.

Lyokone commented 1 week ago

Closing since it's a network error unrelated to FlutterFire