Skip to content
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

fix(fcm): ensure unregistered tokens correctly return :unregistered #221

Conversation

cjbell
Copy link

@cjbell cjbell commented Feb 28, 2022

Currently an unregistered token in FCM will return an unknown_error response, which is incorrect. This PR correctly returns an unregistered atom for this case.

The error coming back from FCM is:

{
  code: 404, 
  details: [
    {
      @type: type.googleapis.com/google.firebase.fcm.v1.FcmError, 
      errorCode: UNREGISTERED
    }
  ], 
  message: Requested entity was not found., 
  status: NOT_FOUND
}

@stefanchrobot
Copy link

Maybe it would be better to actually look at the error code? Here's the decoded response body for an unregistered token:

%{
  "error" => %{
    "code" => 404,
    "details" => [
      %{
        "@type" => "type.googleapis.com/google.firebase.fcm.v1.FcmError",
        "errorCode" => "UNREGISTERED"
      }
    ],
    "message" => "Requested entity was not found.",
    "status" => "NOT_FOUND"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants