-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash after calling task.getResult().getToken() - IllegalArgumentException: method POST must have a request body. #1540
Comments
I found a few problems with this issue:
|
@grebulon : It seems like the Firebase Installations's weekly Question: What percentage of end-users is affected or are all affected? FYI:
|
@grebulon Thanks for all the details on reproducing this issue. Have you enabled HttpResponseCaching in your app? |
@andirayo, this effects many users. I've had around to 500 of reports on this from my automated crash reporting code in the past 3 weeks. That's only from people who chose to report. I think that in the end it will affect ALL users. @ankitaj224 HttpResponseCache is not enabled. Thank you for looking into this. |
@grebulon Are you able to reproduce this issue consistently ? And if there is a demo app, can you please share the link which I can use to test. |
@ankitaj224 Not consistently. But I have enough users to push an update and wait for the next cache invalidation (which usually happens on weekends) and see if this helps. |
@grebulon Do you use initialize Okhttp client with a cache in your app? |
@ankitaj224 I don't do anything explicit with the connection cache, so it must be using the default state. |
FCM registration tokens are constant for the lifetime of installations of your application, unless FCM has a reason to update the tokens. Question: Did this behavior change for you? |
That's OK as I'm not seeing tokens being replaced, and I'm not getting any more of the crashes after downgrading. |
@grebulon firebase-messaging: 20.2.1 will be released by this week (June 19 2020) that should contain caching fix. Please try releasing the app with the latest version and let me know if it fixes the issue. Thank you for testing out the fix. |
Hey @grebulon. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically. If you have more information that will help us get to the bottom of this, just add a comment! |
Just to let you know that I can't do the test right now, but I'm on it and will test as soon as my release timeline has a free slot. |
Thanks @grebulon . Looking forward to hearing how the tests go. |
Hey @grebulon. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically. If you have more information that will help us get to the bottom of this, just add a comment! |
Hello Ankita (and googlebot) |
@grebulon Thanks for the information. Keep us posted on your beta release results. |
I think it's safe to say that this bug is fixed. I'm still running the new version in a beta group of a few hundreds and if there's another problem I will report. Thank you for handling this so professionally. |
Thanks for the confirmation @grebulon . I will go ahead and close this issue for now. Please feel free to reopen if you continue to see the issue. |
[READ] Step 1: Are you in the right place?
yes
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
Sometimes, after calling
task.getResult().getToken()
my app crashes with the following stack.This happens occasionally, usually once a week. After that the app keeps crashing on startup and the only thing that stops it from crashing is to delete the cache from Android's app settings.
I suspect it has to do with caching of the token because after cleaning the cache will make the problem goes away (until the next cache refresh)
Note that I'm using okhttp 3.12.10 - the latest version that supports Android 4.4 (API 19). In okhttp 4.0, the code that throws this error is gone.
Looking in the okhttp source code, it seems that the problem is just as the error message says: FirebaseInstallationServiceClient is posting with
body == null
. I'd look inFirebaseInstallationServiceClient.writeGenerateAuthTokenRequestBodyToOutputStream
but the source code is not in this git repository.In my various emails with Firebase support they hinted that some of the initialization options are missing (API key, Project ID, etc.) but I'm using the automatic initialization with the gradle plugin and google-services.json exactly as described in the docs. Furthermore, I validated that the info from google-services.json is merged into the apk's resources and that firebase is initialized properly (by calling FirebaseApp.initializeApp() which lead to a log stating: "FirebaseApp name [DEFAULT] already exists!"
Steps to reproduce:
First you need to compile with okhttp 3.12.10 (any 3.12.x will do)
Then call
task.getResult().getToken()
as in the code below.Run it for some time, probably several times every day for a week, and it will probably happen. I think this has to do with caching of the token because after this crashes, it will keep on crashing until you clear the cache.
Relevant Code:
The text was updated successfully, but these errors were encountered: