Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

bug: report details of an FCM "INVALID_ARGUMENT" error #1430

Merged
merged 3 commits into from
Aug 10, 2020
Merged

Conversation

jrconlin
Copy link
Member

@jrconlin jrconlin commented Aug 7, 2020

Issue #1373

Description

This is a really quick patch to try and capture the relevant details returned from FCM when it returns an INVALID_ARGUMENT error. I had thought it was related to the TTL, but we already trim it down to an appropriate max value.

Testing

Honestly, if I could figure out how to trigger this in dev, I'd be thrilled. As it is, to test this you'll need a valid FCM routing number, which means compiling an emulated FCM client app (the sample one works fine) which means updating Android Studio to 5, and fetching the latest updates, before altering the code paths and java code to match the FCM project you declared so that the downloaded google-services.json file tied to the sample app you declared in FCM match then use a combination of registration and send scripts to try to trigger an INVALID_ARGUMENT error that gets dumped out to sentry.

All for a patch to see what's going on, and not the real fix.

Issue(s)

Issue #1373

@jrconlin jrconlin requested a review from a team August 7, 2020 01:04
@AzureMarker
Copy link
Contributor

I have the necessary testing setup ready, I'll try to reproduce the issue with this PR.

AzureMarker
AzureMarker previously approved these changes Aug 7, 2020
@AzureMarker
Copy link
Contributor

AzureMarker commented Aug 7, 2020

I think the error is due to incorrectly accounting for FCM's (total) message size limit, a la mozilla-services/autopush-rs#203. It looks like all of the message_size values in Sentry are around 4094 bytes, 2 bytes under the 4096 limit.

I was able to trigger the error by passing through a message which just passed under our size validation but when wrapped in the FCM payload was over 4096 bytes.

Edit: also the error object did not have any details: Server error: INVALID_ARGUMENT: Request contains an invalid argument. No Details

Edit 2: The full FCM response:

{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT"
  }
}

@jrconlin
Copy link
Member Author

jrconlin commented Aug 7, 2020

Huh, that explains why we're not seeing additional details. Interesting. I'll try a few test runs as well and see if I can duplicate. Thanks!

* Ensure that outbound messages cap at 4096 bytes for the payload
* Try to be helpful about message lengths.
@jrconlin jrconlin merged commit 2f08e88 into master Aug 10, 2020
@jrconlin jrconlin deleted the bug/1373 branch October 7, 2020 23:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants