question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FirebaseRemoteConfigClientException The client had an error while calling the backend!

See original GitHub issue

Hi @jamesdaniels

i have issue with FirebaseRemoteConfig, below is the image which I added SSL certificate for api calling is not working in android 5.0 and 6.0 because of https issue, so i added this SSL self trust manager in my app and api calling is working in all device by Firebase remote config not working,

Capture

implementation platform('com.google.firebase:firebase-bom:29.0.3') implementation 'com.google.firebase:firebase-analytics-ktx' implementation 'com.google.firebase:firebase-crashlytics-ktx' implementation 'com.google.firebase:firebase-config-ktx'

Capture2

and here is FirebaseRemotoConfig code to get value from Firebase Remote config, i am getting error like this com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException: The client had an error while calling the backend!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
HemilTheRebelcommented, May 22, 2022

I have not added any Custom SSL certificates, yet, I am getting this exact exception. I narrowed down the problem to this exception: javax.net.ssl.SSLHandshakeException: SSL handshake aborted: ssl=0xd5561908: I/O error during system call, Connection reset by peer

This happens in the file ConfigFetchHttpClient.java in the catch block in fetch() method. The url is that firebase is trying to hit is: https://firebaseremoteconfig.googleapis.com/v1/projects/98058910649/namespaces/firebase:fetch

Here is the stacktrace

 0 = {StackTraceElement@15324} "com.google.android.gms.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)"
 1 = {StackTraceElement@15325} "com.google.android.gms.org.conscrypt.NativeSsl.doHandshake(:com.google.android.gms@221514031@22.15.14 (100700-441847897):6)"
 2 = {StackTraceElement@15326} "com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms@221514031@22.15.14 (100700-441847897):16)"
 3 = {StackTraceElement@15327} "com.android.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:196)"
 4 = {StackTraceElement@15328} "com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:153)"
 5 = {StackTraceElement@15329} "com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:116)"
 6 = {StackTraceElement@15330} "com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:186)"
 7 = {StackTraceElement@15331} "com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)"
 8 = {StackTraceElement@15332} "com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)"
 9 = {StackTraceElement@15333} "com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)"
 10 = {StackTraceElement@15334} "com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)"
 11 = {StackTraceElement@15335} "com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)"
 12 = {StackTraceElement@15336} "com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)"
 13 = {StackTraceElement@15337} "com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:262)"
 14 = {StackTraceElement@15338} "com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:219)"
 15 = {StackTraceElement@15339} "com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:30)"
 16 = {StackTraceElement@15340} "com.google.firebase.remoteconfig.internal.ConfigFetchHttpClient.setFetchRequestBody(ConfigFetchHttpClient.java:364)"
 17 = {StackTraceElement@15341} "com.google.firebase.remoteconfig.internal.ConfigFetchHttpClient.fetch(ConfigFetchHttpClient.java:196)"
 18 = {StackTraceElement@15342} "com.google.firebase.remoteconfig.internal.ConfigFetchHandler.fetchFromBackend(ConfigFetchHandler.java:312)"
 19 = {StackTraceElement@15343} "com.google.firebase.remoteconfig.internal.ConfigFetchHandler.fetchFromBackendAndCacheResponse(ConfigFetchHandler.java:283)"
 20 = {StackTraceElement@15344} "com.google.firebase.remoteconfig.internal.ConfigFetchHandler.lambda$fetchIfCacheExpiredAndNotThrottled$1$ConfigFetchHandler(ConfigFetchHandler.java:220)"
 21 = {StackTraceElement@15345} "com.google.firebase.remoteconfig.internal.-$$Lambda$ConfigFetchHandler$PAoFtfQiOtbXSTeK4H2aFJ-JNJI.then(Unknown Source:8)"
 22 = {StackTraceElement@15346} "com.google.android.gms.tasks.zze.run(com.google.android.gms:play-services-tasks@@18.0.1:1)"
 23 = {StackTraceElement@15347} "java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)"
 24 = {StackTraceElement@15348} "java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)"
 25 = {StackTraceElement@15349} "java.lang.Thread.run(Thread.java:919)"
0reactions
argzdevcommented, Nov 14, 2022

Hi @GauravCreed, I’m glad you were able to find a solution for your issue.

1 - Add https in all api url

Using “https” for all your API calls is definitely a good thing in terms of security.

2 - Change minSdkVersion to 24

This should be okay to do.

4 - Add below method when you called api and check url is correct or not

This seems a bit counterproductive, since you’ve setup all APIs as https, and yet you’re replacing them on your getCorrectURL.

3 - Update in manifest file usesCleartextTraffic to true

In the Android official docs, android:usesCleartextTraffic : indicates whether the app intends to use cleartext network traffic, such as cleartext HTTP. The default value for apps that target API level 27 or lower is “true”. Apps that target API level 28 or higher default to “false”.

There hasn’t been any update yet on the bug ticket. And unfortunately, there’s no officially recommended solution yet for this use case.

However, I do think that if this works for you and it should be fine. As long as you know the security issue this may present. In the Android official docs, “The key reason for avoiding cleartext traffic is the lack of confidentiality, authenticity, and protections against tampering; a network attacker can eavesdrop on transmitted data and also modify it without being detected.”

Read more comments on GitHub >

github_iconTop Results From Across the Web

The client had an error while calling the backend! · Issue #1515
FirebaseRemoteConfigClientException : The client had an error while calling the backend! at com.google.firebase.remoteconfig.internal.
Read more >
FirebaseRemoteConfigClientExc...
FirebaseRemoteConfigClientException : The client had an error while calling the backend! at com.google.android.gms.tasks.
Read more >
FirebaseRemoteConfigClientExc...
FirebaseRemoteConfigClientException (@NonNull String detailMessage). Creates a Firebase Remote Config client exception with the given message.
Read more >
Firebase Remote Config: 3 lessons learned - Dipien
FirebaseRemoteConfigClientException : The client had an error while calling the backend! It's a good idea to add a retry logic, so you guarantee...
Read more >
Error message :: RemoteConfigException - Samsung Members
Error Message :: FirebaseRemoteConfigException: The client had an error while calling the backend! Could you please help me to get rid of ...
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