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: Wait for endpoint creation to identify user #13353

Merged
merged 3 commits into from May 10, 2024

Conversation

cshfang
Copy link
Contributor

@cshfang cshfang commented May 9, 2024

Description of changes

When the Push Notification category is first creating a Pinpoint endpoint upon receiving a device token, it is possible for an identifyUser call to be attempting to update the endpoint to be resolved first over the network. This is troublesome for at least two known reasons:

  1. The identifyUser call could be attempting to set the OptOut property to 'NONE' and if it is resolved first by the service, the service will reject the request due to the Address not having yet been set.
  2. The identifyUser call could contain userId or demographic information and if it resolved first by the service, the request made by the library to register the device token would contain default values which would unintentionally overwrite the ones set by identifyUser

This PR mitigates this by having identifyUser calls (for Push Notification channels) await the resolution of device registration during endpoint creation (i.e. this blocking does not occur during endpoint updates).

Issue #, if available

#13174
#13272

Description of how you validated changes

  • Added unit tests for added use cases
  • yarn test
  • Tested in a sample React Native application to assert identifyUser calls were blocked on the endpoint creation triggered by device registration but not on subsequent updates

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@cshfang cshfang requested review from a team as code owners May 9, 2024 23:10
HuiSF
HuiSF previously approved these changes May 9, 2024
@cshfang cshfang merged commit f17cdf0 into aws-amplify:main May 10, 2024
30 checks passed
@cshfang cshfang deleted the fix/notifications-issues branch May 10, 2024 23:04
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.

None yet

3 participants