-
Notifications
You must be signed in to change notification settings - Fork 626
Closed
Labels
Description
Describe your environment
- Android Studio version: 3.5.1
- Firebase Component: Remote Config (Database, Firestore, Storage, Functions, etc)
- Component version: 19.0.3
- Issue found on: API 17 (Below Kitkat)
Describe the problem
Firebase remote config fails to fetch config values on API level below 19. Exception thrown is FirebaseRemoteConfigServerException: Bad Request
.
Steps to reproduce:
Run the official sample code - https://github.com/firebase/quickstart-android/tree/master/config on any API 17 emulator.
Click on 'Run the java version ...'
- What happened
Fetch fails and the exception thrown iscom.google.firebase.remoteconfig.FirebaseRemoteConfigServerException
with message -Bad request
.
Complete trace -
com.google.firebase.remoteconfig.FirebaseRemoteConfigServerException: Fetch failed: The server returned an unexpected error.
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler.createExceptionWithGenericMessage(com.google.firebase:firebase-config@@19.0.3:351)
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler.fetchFromBackend(com.google.firebase:firebase-config@@19.0.3:304)
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler.fetchFromBackendAndCacheResponse(com.google.firebase:firebase-config@@19.0.3:251)
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler.fetchIfCacheExpiredAndNotThrottled(com.google.firebase:firebase-config@@19.0.3:191)
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler.lambda$fetch$0(com.google.firebase:firebase-config@@19.0.3:160)
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler$$Lambda$1.then(com.google.firebase:firebase-config@@19.0.3)
at com.google.android.gms.tasks.zzf.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)
Caused by: com.google.firebase.remoteconfig.FirebaseRemoteConfigServerException: Bad Request
at com.google.firebase.remoteconfig.internal.ConfigFetchHttpClient.fetch(com.google.firebase:firebase-config@@19.0.3:189)
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler.fetchFromBackend(com.google.firebase:firebase-config@@19.0.3:278)
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler.fetchFromBackendAndCacheResponse(com.google.firebase:firebase-config@@19.0.3:251)
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler.fetchIfCacheExpiredAndNotThrottled(com.google.firebase:firebase-config@@19.0.3:191)
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler.lambda$fetch$0(com.google.firebase:firebase-config@@19.0.3:160)
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler$$Lambda$1.then(com.google.firebase:firebase-config@@19.0.3)
at com.google.android.gms.tasks.zzf.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
Upon further inspection, looks like the analyticsUserProperties
user property is wrongly formatted in the request body.
on API 17 -
{
"platformVersion": "17",
"languageCode": "en_GB",
"analyticsUserProperties": "{}",
"appId": "[REDACTED]",
"packageName": "com.google.firebase.quickstart.invites",
"appVersion": "1.0",
"appInstanceId": "REDACTED",
"appInstanceIdToken": "REDACTED",
"countryCode": "GB",
"timeZone": "Asia\/Calcutta",
"sdkVersion": "19.0.3"
}
Response -
{
"error": {
"code": 400,
"message": "Invalid value at 'analytics_user_properties' (type.googleapis.com/google.firebase.remoteconfig.v1.FetchRemoteConfigRequest.AnalyticsUserPropertiesEntry), \"{}\"",
"status": "INVALID_ARGUMENT",
"details": [{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [{
"field": "analytics_user_properties",
"description": "Invalid value at 'analytics_user_properties' (type.googleapis.com/google.firebase.remoteconfig.v1.FetchRemoteConfigRequest.AnalyticsUserPropertiesEntry), \"{}\""
}]
}]
}
}
on API 21 -
{
"platformVersion": "17",
"languageCode": "en_GB",
"analyticsUserProperties": {},
"appId": "[REDACTED]",
"packageName": "com.google.firebase.quickstart.invites",
"appVersion": "1.0",
"appInstanceId": "REDACTED",
"appInstanceIdToken": "REDACTED",
"countryCode": "GB",
"timeZone": "Asia\/Calcutta",
"sdkVersion": "19.0.3"
}
If JSONObject().toString() is done on a nested map objects it produces "{}"
instead of just {}
, on API(17). If someone could explain this that would be doubly helpful, thanks.
Between, on remote config version 18.0.0 it works fine.