aws-amplify / aws-sdk-android

AWS SDK for Android. For more information, see our web site:
https://docs.amplify.aws
Other
1.03k stars 549 forks source link

Pinpoint endpoint not registering #3256

Closed TimothyChilvers closed 1 year ago

TimothyChilvers commented 1 year ago

Describe the bug When I launch my app and identify the user to Pinpoint, I get an endpoint ID with an address and the User ID in response. When I try and send a push notification to the endpoint, I get an Endpoint does not exist error, even >12 hours after creating the endpoint. I can send a push notification to the Address directly.

The same code can successfully create endpoints and send push notifications to endpoints for a different Pinpoint App using a build variant.

To Reproduce Unsure

Which AWS service(s) are affected? Pinpoint

Expected behavior Endpoint is created on Pinpoint backend.

Environment Information:

Additional context Support Case 12532323301

tjleing commented 1 year ago

Hello @TimothyChilvers, thank you for reaching out! Just to clarify a few things:

  1. What do you mean by identifying the user to Pinpoint, is that targetingClient.updateEndpointProfile(profile) to set the user ID?
  2. Are you using pinpointManager.getNotificationClient().registerDeviceToken([token created by Firebase]) as described here?
  3. Also on that page, have you ran amplify init, amplify add notifications and amplify push to generate a configuration file with the Pinpoint app id?
  4. How did you set up Firebase? Is the API key successfully added to Pinpoint to set up the push notification channel for that app?
  5. How are you trying to send the push notification? Is it a test message through the Pinpoint console, or are you trying a campaign with a segment involving the user ID that you set, or through a terminal calling aws pinpoint send-messages?
  6. Are there any logs being printed? If the endpoint profile is being set you should see a log saying Updating EndpointProfile. and then one saying EndpointProfile updated successfully. If not, there may be an issue with internet connection or even a bug which is causing the endpoint to be created but not persisted to the cloud.

Hope we can get to the bottom of this!

TimothyChilvers commented 1 year ago

So this turned out to be not-quite an AWS SDK issue. We have an observability package which, among other things, swizzles network requests including those made from the AWS SDK. This swizzling, and modification of those requests, caused some kind of integrity check failure in AmazonPinpoint.updateEndpoint as a result of Cognito ID generation - so we were making Cognito IDs, but the ID wasn't being passed on to Pinpoint to create an Endpoint with the Cognito ID due to this client side validation failure.

I've since turned off that feature of our o11y tooling and it works as expected. My apologies for the false alarm.