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

[Bug]: One or more Aliases claimed by another User - HttpClient - DefaultDispatcher - API rate limit exceeded #1830

Closed
1 task done
michael-winkler opened this issue Sep 4, 2023 · 18 comments

Comments

@michael-winkler
Copy link

michael-winkler commented Sep 4, 2023

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

  • I agree to follow this project's Code of Conduct
@michael-winkler
Copy link
Author

See issue OneSignal/OneSignal-Flutter-SDK#714

@michael-winkler
Copy link
Author

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.

@jennantilla
Copy link
Contributor

@michael-winkler thank you for reporting this! We're investigating and will get back to you as soon as possible.

@michael-winkler
Copy link
Author

@jennantilla Is this also fixed in 5.0.2 ?

@Munzey
Copy link

Munzey commented Oct 13, 2023

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

@sarbyn
Copy link

sarbyn commented Oct 16, 2023

Same as @Munzey, we got same issue with 5.0.0, 5.0.2 and 5.0.3

@RogerBrusamarello
Copy link

Any updates here?

@JennyFieldings12
Copy link

Also happening for me on Android, is there any fixes for this?

@michael-winkler
Copy link
Author

Looks like the issue is resolved.

@zmnv
Copy link

zmnv commented Jun 20, 2024

@michael-winkler how?

@michael-winkler
Copy link
Author

I did got this type of bug again.

@andreuka
Copy link

same issue here

@Yurockkk
Copy link

any updates..?

@michael-winkler
Copy link
Author

@jkasten2 Can you take a look here? Thank you very much

@jkasten2
Copy link
Member

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?

@HaniKhaledAli
Copy link

@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

@jkasten2
Copy link
Member

jkasten2 commented Jul 9, 2024

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

@jkasten2 jkasten2 closed this as completed Jul 9, 2024
@codefever7
Copy link

same issue with "react-onesignal v3.0.1"

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

No branches or pull requests