amplify-js: Pinpoint: Exceeded maximum endpoint per user count: 10
Describe the bug
After upgrading to "@aws-amplify/analytics": "^4.0.0" push notifications have stopped working. I can no longer update endpoints. This was originally solved in #5423 but seems to have reappeared recently. Possibly related to the merge in #7245 .
To Reproduce Install the app on a device more than 10 times.
Expected behavior Amplify should clear old endpoints as mentioned in the docs.
Environment
System:
OS: macOS 10.15.7
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Memory: 208.17 MB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 14.2.0 - ~/.nvm/versions/node/v14.2.0/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.2.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Browsers:
Chrome: 86.0.4240.198
Firefox: 82.0.3
Safari: 14.0
npmPackages:
@apollo/client: ^3.2.7 => 3.2.7
@aws-amplify/analytics: ^4.0.0 => 4.0.0
@aws-amplify/auth: ^3.4.12 => 3.4.12
@aws-amplify/cache: ^3.1.37 => 3.1.37
@aws-amplify/core: ^3.8.4 => 3.8.4
@aws-amplify/storage: ^3.3.12 => 3.3.12
@babel/core: ^7.8.4 => 7.11.6
@babel/runtime: ^7.8.4 => 7.9.2
@bugsnag/react-native: ^7.5.2 => 7.5.2
@expo/react-native-action-sheet: ^3.8.0 => 3.8.0
@react-native-community/art: ^1.2.0 => 1.2.0
@react-native-community/async-storage: ^1.12.1 => 1.12.1
@react-native-community/eslint-config: ^1.1.0 => 1.1.0
@react-native-community/masked-view: ^0.1.10 => 0.1.10
@react-native-community/netinfo: ^5.9.7 => 5.9.7
@react-native-community/picker: ^1.8.1 => 1.8.1
@react-native-community/push-notification-ios: 1.7.3 => 1.7.3
@types/react: 16.9.56 => 16.9.56
amazon-cognito-identity-js: ^4.5.5 => 4.5.5
apollo-link-retry: ^2.2.16 => 2.2.16
appcenter: 3.1.2 => 3.1.2
appcenter-analytics: 3.1.2 => 3.1.2
appcenter-crashes: 3.1.2 => 3.1.2
aws-appsync-auth-link: ^3.0.2 => 3.0.2
aws-appsync-subscription-link: ^3.0.3 => 3.0.3
babel-jest: ^25.1.0 => 25.5.1
eslint: ^6.5.1 => 6.8.0
exponential-backoff: ^3.1.0 => 3.1.0
graphql: 15.4.0 => 15.4.0
jest: ^25.1.0 => 25.5.4
lodash.debounce: ^4.0.8 => 4.0.8
lodash.throttle: ^4.1.1 => 4.1.1
metro-react-native-babel-preset: ^0.59.0 => 0.59.0
moment: ^2.29.1 => 2.29.1
moment-timezone: ^0.5.32 => 0.5.32
prop-types: ^15.7.2 => 15.7.2
react: 16.13.1 => 16.13.1
react-dom: ^16.12.0 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-animatable: ^1.3.3 => 1.3.3
react-native-camera: 3.40.0 => 3.40.0
react-native-code-push: ^6.4.0 => 6.4.0
react-native-config: 1.4.0 => 1.4.0
react-native-country-picker-modal: ^2.0.0 => 2.0.0
react-native-device-info: ^7.1.0 => 7.1.0
react-native-fast-image: ^8.3.4 => 8.3.4
react-native-fs: ^2.16.6 => 2.16.6
react-native-gesture-handler: ^1.8.0 => 1.8.0
react-native-get-random-values: ^1.5.0 => 1.5.0
react-native-haptic-feedback: ^1.11.0 => 1.11.0
react-native-orientation-locker: ^1.2.0 => 1.2.0
react-native-permissions: ^2.2.2 => 2.2.2
react-native-progress: ^4.1.2 => 4.1.2
react-native-reanimated: ^1.13.2 => 1.13.2
react-native-root-toast: ^3.2.1 => 3.2.1
react-native-safe-area-context: ^3.1.9 => 3.1.9
react-native-safe-area-view: ^2.0.0 => 2.0.0
react-native-screens: ^2.15.0 => 2.15.0
react-native-share: 4.1.0 => 4.1.0
react-native-svg: ^12.1.0 => 12.1.0 => 0.3.4
react-native-tab-view: ^2.15.2 => 2.15.2
react-native-vector-icons: 7.1.0 => 7.1.0
react-native-video: ^5.1.0-alpha8 => 5.1.0-alpha8
react-native-webview: ^10.10.2 => 10.10.2
react-navigation: ^4.4.3 => 4.4.3
react-navigation-props-mapper: ^1.0.0 => 1.0.4
react-navigation-stack: ^2.10.1 => 2.10.1
react-navigation-tabs: ^2.10.1 => 2.10.1
react-test-renderer: 16.13.1 => 16.13.1
uuid: ^8.3.1 => 8.3.1
npmGlobalPackages:
@aws-amplify/cli: 4.32.1
appcenter-cli: 2.7.2
gatsby-cli: 2.14.0
lerna: 3.22.1
npm: 6.14.8
serverless: 2.11.1
typescript: 3.9.6
Additional context May be related to #7245
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 26
- Comments: 92 (24 by maintainers)
All,
Just wanted to provide an update here to this issue. We are working internally with the Amazon Pinpoint team on this. While we are working on a solution, we may reach out to some of you to understand your use case more. Thank you for your patience on this!
Hi @sammartinez, thanks for asking. I would consider my case temporarily mitigated by rolling back, but the underlying issue re-introduced in
@aws-amplify/analytics": "4.0.0"is still a problem. We uninstall / re-install apps so often that we quickly hit that 10 endpoint limit. It could also affect our production users though it would be more of an edge case. With no way for us to manage endpoints, this issue effectively breaks push notifications.To me, this is a showstopper that precludes us from upgrading to
4.0.0and beyond. We’re locked into specific versions and might not be able to benefit from future features or security patches. I feel we either need some mechanism to manually manage endpoints, automated management of endpoints in Amplify or (preferably) in Pinpoint, or other guidance that would allow us to continue staying current with Amplify packages while avoiding this issue.I’ve realized that this issue is a critical security vulnerability. The version of
aws-amplifythat mitigates the Exceed maximum endpoint per user problem discussed in this issue is 3.3.8. That version ofaws-amplifyexposes two security problems.@aws-amplify/datastorecontains a dependency toimmer@6.0.1. That package contains an exploit documented in CVE-2020-28477.@aws-amplify/api-restand@aws-amplify/storagedepend onaxios@0.19.0. The vulnerability in that package is documented in CVE-2020-28168.The affected dependencies have been upgraded to patched versions in the latest release of
@aws-amplify, however we are stuck on 3.3.8 because of the endpoint issue.@sammartinez This is a show-stopping issue for us. Can you please provide some update on progress and/or a mitigation strategy we can implement today?
Hi @abdallahshaban557, any news on this issue?
FWIW, I’ve discovered that you can sidestep this issue by specifying your own endpointId to override the one that Amplify is assigning by default. If you’re using React Native, this could be as simple as:
Then your user will get a unique (and unchanging) endpoint for each device they use to access your app, which is desirable for per-device push notifications.
This solution will still break if the user has too many devices, but it works for the overwhelming majority. Futhermore, where it falls down, we are arguably viewing the problem as a Pinpoint limitation rather than an Amplify bug.
Hello everyone, we are working with the Pinpoint team to alleviate this issue. In the future, the Pinpoint team is going to allow events to be recorded at the “User” level rather than at the endpoint, which would mean that the creation of the 15 endpoints would be significantly less prone to happen since an endpoint would not be required for recording analytics events. We will keep you updated when we have a path forward.
@josefaidt - any chance you can take a look at this issue? 🙏🏼
Hi @sammartinez,
It has been 5 months this issue has been open for, pretty much every single application that has aws-amplify installed with a version over 3.3.8+ will eventually have users no longer receive push notifications, I can imagine that could be thousands of projects.
For us we are currently waiting to release a new project because of this blocker and are also facing a fresh round of amplify / push notification problems with an update to an existing application.
When can we expect a resolution to this issue / stability to amplify push notifications?
I am on 3.3.26, and as soon as I call Analytics.updateEndpoint post login, I run into this issue:
ERROR [ERROR] 53:35.387 AWSPinpointProvider - updateEndpoint failed [BadRequestException: Exceeded maximum endpoint per user count:15].
Hello Everyone,
I wanted to provide an update here. We have been working with the Pinpoint team on resolving this issue. On the Pinpoint service, they are now detaching the oldest push endpoint from the user. @kylekirkby @joebernard @dylan-westbury Can you please try the latest of the Analytics category and validate you are not receiving the error? If you are, please share them so we can take any errors back to the Pinpoint team. Thanks again for being patience with us on this.
Hi @wasurocks - we completely agree with you, this is extremely frustrating. We are working closely with the Pinpoint team to get this resolved. We will provide timelines on when we expect this issue to be resolved.
Even the official doc has the same issue prompting in the console
Exceeded maximum endpoint per user count
Any news on this issue? We still suffer from this issue.
Is there any update on this issue? I am still running into this issue with aws-amplify 4.3.8:
Strangely, even after deleting all endpoints for the given user with
aws pinpoint delete-user-endpoint ..., the problem persists…I received this error - exceeded maximum endpoints per user count: 15 just 39 hours ago…I don’t believe it is fixed.
Thanks for this feedback everyone, I am sharing this feedback with the Amazon Pinpoint team since they should handle this within the Service. Will provide an update early next week or once I hear something.
@sammartinez I updated to
"aws-amplify": "3.3.27"and am no longer able to reproduce this issue locally.I installed and re-installed my React Native app onto a test device 15 times and called
updateEndpointafter each installation. Each time the result was SUCCESS. I also verified that I could receive a push notification on that device after 15 installation attempts.I see that others are still running into this issue so I will keep it open and continue testing.
Hi @joebernard
We upgraded aws-amplify and noticed this issue, so we downgraded back to the last working version we had within the app, which was:
"aws-amplify": "3.3.8",We no longer received the “exceeded maximum endpoint per user” once we downgraded.
FWIW, we have had success by using the following to configure Amplify Analytics:
where
uniqueIdis the result of a call toDeviceInfo.getUniqueId()from thereact-native-device-infopackage. This effectively gives you one single endpoint per device.A full year in and we still need-discussion and investigating…when they had something that worked before…better get the pinpoint team to re-design their entire system instead of leaving in the 3 lines of code that fixed this…
I have noticed for some users:
For example, I can see for a single user the following active endpoints for a single device “iPhone X”:
I read pinpoint documentation, an endpoint will only change to “INACTIVE” when an existing “address” is added to a new endpoint. This can be problematic because iOS refreshes the push token which is used as the address for an endpoint, so an endpoint with an old address / token can remain ACTIVE.
I also noticed some new endpoints have changed from optOut “NONE” to “ALL” over time, I don’t think that should be happening because each time the token refreshes we update the optOut to “NONE”. Could endpoints be changing from “NONE” to “ALL” ?
This is our code to update endpoint address with push token.
We ask for push notification permissions when user is logged in also, but as a safety we save the token in storage and update the endpoint with that token (if it exists) from async storage in case for whatever reason a new endpoint is created without the address as the token.
We also set the user session to expire after a very long while, so there isn’t any conflict with the user having to log back in and mess up the existing endpoint in some way
any update?
I’m getting this error with @aws-amplify/analytics 4.0.22 so it doesn’t seem to be fixed for me either.
Hi @irfancnk - I am no longer a part of the Amplify team - I am adding @haverchuck /@renebrandel/ @cwomack to help answer this for you.
Hi @nubpro
Amplify version is
4.3.12@aws-amplify/pushnotification version is4.3.9Were you expecting it to be fixed in these versions? This is in dev, but we are facing push notification issue in production.
What we notice is, overtime users will stop receiving push notifications in production. At first they will work, but then after some months they stop. So assuming the latest endpoint is not able to save once limit is reached, occasionally? Perhaps endpoints are changing from optOut NONE to ALL when creating a new endpoint?
As this issue has been ongoing for 2 years and there has been lots of instructions of how to implement on various Github issues that doesn’t reflect what is shown in the documentation and lots of work arounds and hacks posted by everyone, is it possible to provide the exact expected way to implement and we can test that?
For example, do we still need to update the endpoint ourselves like this. For our use case, we request push permission once user is logged in in iOS and update when onRegister is called. But we also store in local storage and update providing it exists as well as the userId, because for Android the user may not be logged in when the token is received.
Or can we depend on @aws-amplify/pushnotification to do this for us?
Or another preferred suggestion?
Hi, thanks for the information. I am still trying to understand the root cause of it by talking to pinpoint team. Can you help me confirm if it is the case:
For web, the endpoint id is created and cached in local storage.
Normally it will be persisted so you should not run into the issue of creating another endpoint and reach limit, but if you are using Incognito or manually clean the localStorage, then the endpoint id will be recreated.
For now, if the endpoint channel type is “PUSH” ( e.g. ADM, PUSH, GCM, APNS, APNS_VOIP, APNS_VOIP_SANDBOX, BAIDU), then pinpoint will auto evict it if there are more than 15 endpoints associated with the userId (by default, Amplify use the identity id from identity pool as the userId).
The auto eviction won’t apply to the “Email” channel type though. In this case, we need to delete the overflowed endpoints if they reach the limits.
@sammartinez any update on this? Still experiencing this with the latest release…
FYI, I am now seeing 13 endpoints for 1 user. I am not seeing any errors, but I also don’t see a purge of stale endpoints.
@BabyDino on your question, the Amazon Pinpoint team has let me know that it’s based on the last active date they are using for the detach of unused endpoints
Thanks for the update @sammartinez!
@sammartinez Any idea when we will actually be able to use Pinpoint analytics in our Amplify apps?
Not only am I now stuck on this issue, I’ve also had to do some ridiculous workarounds to get Pinpoint working with Group based auth roles (Amplify CLI). It seems that the Amplify team has completely neglected the Pinpoint product within this stack as that group-based auth issue still isn’t solved either…
https://github.com/aws-amplify/amplify-cli/issues/5004 https://github.com/aws-amplify/amplify-cli/issues/4772
Same issue here, waiting for the fix to publish an app.
hey @joebernard
I can confirm this includes the endpoint management code.
You can also check by yourself with, e.g.
(This is comparing
@aws-amplify/analytics@3.3.12-hotfix.0and@aws-amplify/analytics@latest)Hey @joebernard, thanks for this callout. I will work with the team on seeing about getting an update to version
3.3.8to update these dependencies specifically. Our ETA for this is later today. I will let you know once we update the version with the callouts above. As for the update on the mitigation, we are working with the Pinpoint team on this and will provide a timeline once we have one for you.