[Bug]: One or more Aliases claimed by another User - HttpClient - DefaultDispatcher - API rate limit exceeded
What happened?
See Logcat details:
[DefaultDispatcher-worker-3] HttpClient: PATCH RECEIVED JSON: {"errors":["API rate limit exceeded"],"limit":"Subscription/User Update Per Device"}
[DefaultDispatcher-worker-3] HttpClient: PATCH RECEIVED JSON: {"errors":[{"code":"user-2","title":"One or more Aliases claimed by another User","meta":{"external_id":"[email protected]"}}]}
[DefaultDispatcher-worker-4] HttpClient: POST RECEIVED JSON:
[DefaultDispatcher-worker-7] HttpClient: PATCH RECEIVED JSON: {"errors":["API rate limit exceeded"],"limit":"Subscription/User Update Per Device"}
This happens only if you use onesignal android sdk 5.0.0. The warnings did not appear for below versions.
Steps to reproduce?
I think the problem is that it is possible that one user can have multiple subscriptions.
If a user got two devices then two subscriptions are possible.
But if thats the case then you will see the warnings inside logcat.
As second information I already did the migration which is described here:
https://documentation.onesignal.com/docs/generate-firebase-credentials
What did you expect to happen?
The warnings should not appear
OneSignal Android SDK version
5.0.0
Android version
13, 12, 11, 10, 9, 8, 7.1, 7.0, 6, 5.1, 5.0, 4.4, 4.3 or below
Specific Android models
All
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
See issue https://github.com/OneSignal/OneSignal-Flutter-SDK/issues/714
I can confirm that the problem only occurs when one user has multiple devices. This scenario can indeed happen in reality. Therefore, the SDK should accommodate this case instead of continuously generating warnings in the logcat every 10 milliseconds. The multiple log entries can significantly drain the device's battery.
In my case, a new log entry was generated every 10 milliseconds without end.
@michael-winkler thank you for reporting this! We're investigating and will get back to you as soon as possible.
@jennantilla Is this also fixed in 5.0.2 ?
im on 5.0.3 and still happening - can confirm if I delete the subscription to the other device, it then registers the other device
Same as @Munzey, we got same issue with 5.0.0, 5.0.2 and 5.0.3
Any updates here?
Also happening for me on Android, is there any fixes for this?
Looks like the issue is resolved.
@michael-winkler how?
I did got this type of bug again.
same issue here
any updates..?
@jkasten2 Can you take a look here? Thank you very much
Recent versions of the SDKs batch networks calls pretty well, so you shouldn't be seeing rate limit errors. Can you share the logcat with timestamps showing the network calls and code to reproduce the issue?
@jkasten2
I Have sdk onesignal_flutter: ^5.2.0;
I got this error
W/OneSignal(17028): [DefaultDispatcher-worker-6] HttpClient: Got Response = PATCH - STATUS: 409 - Body: {"errors":[{"code":"user-2","title":"One or more Aliases claimed by another User","meta":{"external_id":"33"}}]}
I think this error occurs because the app is being reinstalled multiple times. Why don't merge all users that use the same external_id instead of showing this error? I have more than 15 Subscription they have same OneSignal ID and same external_id
This user-2 error happens when it tries to upgrade the default anonymous User the SDK created to an identified User but it already exists. The SDK handles this response internally by using the existing User going forward.
In summary the SDK handles the error user-2 and should be continuing correctly.
The logcat will reflect this is it is continuing correctly, example logcat:
2024-07-09 17:27:29.752 27103-27139 OneSignal com.onesignal.sdktest D [DefaultDispatcher-worker-1] HttpClient: Request Sent = PATCH https://api.onesignal.com/apps/{{APP_ID}}/users/by/onesignal_id/{{ONESIGNAL_ID}}/identity - Body: {"identity":{"external_id":"YOUR_EXTERNAL_ID"}} - Headers: Accept=[application/vnd.onesignal.v1+json], Content-Type=[application/json; charset=UTF-8], OneSignal-Install-Id=[9d8fb6a1-206e-4e55-9283-58ba2bf579d8], OneSignal-Subscription-Id=[UUID], SDK-Version=[onesignal/android/050117]
2024-07-09 17:27:29.913 27103-27139 OneSignal com.onesignal.sdktest D [DefaultDispatcher-worker-1] HttpClient: Got Response = PATCH https://api.onesignal.com/apps/{{APP_ID}}/users/by/onesignal_id/ONESIGNAL_ID/identity - FAILED STATUS: 409
2024-07-09 17:27:29.913 27103-27139 OneSignal com.onesignal.sdktest W [DefaultDispatcher-worker-1] HttpClient: Got Response = PATCH - STATUS: 409 - Body: {"errors":[{"code":"user-2","title":"One or more Aliases claimed by another User","meta":{"external_id":"YOUR_EXTERNAL_ID"}}]}
2024-07-09 17:27:29.913 27103-27144 OneSignal com.onesignal.sdktest D [OpRepo] LoginUserOperationExecutor now handling 409 response with "code": "user-2" by switching to user with "external_id": "YOUR_EXTERNAL_ID"
2024-07-09 17:27:29.914 27103-27139 OneSignal com.onesignal.sdktest D [DefaultDispatcher-worker-1] HttpClient: Request Sent = POST https://api.onesignal.com/apps/{{APP_ID}}/users - Body: {"identity":{"external_id":"YOUR_EXTERNAL_ID"},"subscriptions":[{"id":"SUBSCRIPTION_ID"}],"properties":{"timezone_id":"America\/New_York","language":"en"},"refresh_device_metadata":true} - Headers: Accept=[application/vnd.onesignal.v1+json], Content-Type=[application/json; charset=UTF-8], OneSignal-Install-Id=[9d8fb6a1-206e-4e55-9283-58ba2bf579d8], OneSignal-Subscription-Id=[UUID], SDK-Version=[onesignal/android/050117]
2024-07-09 17:27:30.189 27103-27139 OneSignal com.onesignal.sdktest D [DefaultDispatcher-worker-1] HttpClient: Got Response = POST https://api.onesignal.com/apps/{{APP_ID}}/users - STATUS: 202 - B