fix: Wait for endpoint creation to identify user #13353
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:identifyUser
call could be attempting to set theOptOut
property to'NONE'
and if it is resolved first by the service, the service will reject the request due to theAddress
not having yet been set.identifyUser
call could containuserId
ordemographic
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 byidentifyUser
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
yarn test
identifyUser
calls were blocked on the endpoint creation triggered by device registration but not on subsequent updatesChecklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.