Firestore exception - Unable to resolve host firestore.googleapis.com,

See original GitHub issue

Hi all. I’m using latest firebase_cloud release to flutter (3.1.6) but I think it’s the sdk issue. I have the following on my code:

result = await FirebaseFirestore.instance .collection( 'fields') .get(GetOptions(source: Source.server));

Which works fine. But! Sometime after the screen of my phone (Pixel 3a android 12, samsung galaxy a12 android 11) goes off, after a while i see the following exception:

W/ManagedChannelImpl( 7914): [{0}] Failed to resolve name. status={1} W/Firestore( 7914): (24.0.0) [WatchStream]: (f8463fe) 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 W/Firestore( 7914): at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:223) W/Firestore( 7914): at io.grpc.internal.DnsNameResolver.doResolve(DnsNameResolver.java:282) W/Firestore( 7914): at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:318) W/Firestore( 7914): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) W/Firestore( 7914): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) W/Firestore( 7914): at java.lang.Thread.run(Thread.java:923) W/Firestore( 7914): Caused by: java.net.UnknownHostException: Unable to resolve host “firestore.googleapis.com”: No address associated with hostname W/Firestore( 7914): at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156) W/Firestore( 7914): at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103) W/Firestore( 7914): at java.net.InetAddress.getAllByName(InetAddress.java:1152) W/Firestore( 7914): at io.grpc.internal.DnsNameResolver$JdkAddressResolver.resolveAddress(DnsNameResolver.java:631) W/Firestore( 7914): at io.grpc.internal.DnsNameResolver.resolveAddresses(DnsNameResolver.java:219) W/Firestore( 7914): … 5 more W/Firestore( 7914): Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname) W/Firestore( 7914): at libcore.io.Linux.android_getaddrinfo(Native Method) W/Firestore( 7914): at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:73) W/Firestore( 7914): at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:202) W/Firestore( 7914): at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:73) W/Firestore( 7914): at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135) W/Firestore( 7914): … 9 more W/Firestore( 7914): }.

When I resume my app, and the above code is called again i get exception:

ERROR: [cloud_firestore/unavailable] The service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff. I/flutter ( 7914): #0 MethodChannelQuery.get (package:cloud_firestore_platform_interface/src/method_channel/method_channel_query.dart:110:7) I/flutter ( 7914): <asynchronous suspension> I/flutter ( 7914): #1 _JsonQuery.get (package:cloud_firestore/src/query.dart:390:9) I/flutter ( 7914): <asynchronous suspension>

Any Idea what causes it? I tried to call retries on the above get() but the same error occurred. The workaround is calling terminate on the firestore object and then recall the above get() and it seem to solve it.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
wu-huicommented, Feb 1, 2022

So this is a grpc-java issue which has been reported here: https://github.com/grpc/grpc-java/issues/8850

In the issue there is a link to a potential fix, we will be working with grpc team to get this released ASAP.

Will update this issue when it is fixed.

0reactions
cedricboidincommented, Mar 14, 2022

It seems that version 24.0.2 of firebase-firestore includes the GRPC fix and solves the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firestore operations (add(), set()) not working - Stack Overflow
net.UnknownHostException: Unable to resolve host "firestore.googleapis.com": No address associated with hostname at java.net.InetAddress.
Read more >
Firestore take long time to retrieve data after reconnecting to ...
UnknownHostException : Unable to resolve host "firestore.googleapis.com": No address associated with hostname. (full stack trace omitted).
Read more >
caused by: java.net.unknownhostexception: unable to resolve ...
Long story short, there are two main reasons for exception: ... UnknownHostException: Unable to resolve host “firestore.googleapis.com”: No address ...
Read more >
Firebase AuthUI - unable to resolve host “www.googleapis ...
Firebase AuthUI - unable to resolve host “www.googleapis.com”: No address associated with hostname (PLEASE READ COMMENT FOR DETAILS).
Read more >
Android Question Unable to resolve host "fcm.googleapis.com"
Since the 27.11 I get the following error : ResponseError. Reason: java.net.UnknownHostException: Unable to resolve host "fcm.googleapis.com": ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found