OneSignal-Android-SDK icon indicating copy to clipboard operation
OneSignal-Android-SDK copied to clipboard

[Bug]: Call to 'login' fails with 'incorrect UUID length' error

Open AndreasBoehm opened this issue 2 years ago • 4 comments

What happened?

Can't receive push notifications because my user is not properly registered in the onesignal backend.

Steps to reproduce?

1. integrate the onesignal SDK
2. use login and logout a couple of times

What did you expect to happen?

I did expect the login to work

OneSignal Android SDK version

Release 5.0.4

Android version

13

Specific Android models

No response

Relevant log output

[main] login(externalId: 1e8b0e2b-7feb-4dfd-xxxx-f7fd813433c7, jwtBearerToken: null)
[main] OperationRepo.enqueue(operation: {"name":"refresh-user","appId":"4e3455d0-10a6-xxxx-bc85-3f4afea449fd","onesignalId":"local-0f3285db-xxxx-4b0d-8392-89c440f24d18"}, flush: true)
HttpClient: Request timed out: apps/4e3455d0-10a6-xxxx-bc85-3f4afea449fd/android_params.js
    kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 65000 ms
    	at kotlinx.coroutines.TimeoutKt.TimeoutCancellationException(Timeout.kt:191)
    	at kotlinx.coroutines.TimeoutCoroutine.run(Timeout.kt:159)
    	at kotlinx.coroutines.EventLoopImplBase$DelayedRunnableTask.run(EventLoop.common.kt:501)
    	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
    	at kotlinx.coroutines.DefaultExecutor.run(DefaultExecutor.kt:109)
    	at java.lang.Thread.run(Thread.java:1012)
[Thread-12] Failed to get Android parameters, trying again in 30 seconds.
[Thread-12] ParamsBackendService.fetchParams(appId: 4e3455d0-10a6-xxxx-bc85-3f4afea449fd, subscriptionId: null)
[DefaultDispatcher-worker-8] HttpClient: GET apps/4e3455d0-10a6-xxxx-bc85-3f4afea449fd/android_params.js
[DefaultDispatcher-worker-8] HttpClient: Adding header if-none-match: W/"d022feffd55d242859d590b4f28e5690"
[DefaultDispatcher-worker-1] HttpClient: GET apps/4e3455d0-10a6-xxxx-bc85-3f4afea449fd/android_params.js - Using Cached response due to 304: {"awl_list":{},"android_sender_id":"729718451091","chnl_lst":[],"enterp":true,"outcomes":{"direct":{"enabled":true},"indirect":{"notification_attribution":{"minutes_since_displayed":60,"limit":10},"enabled":true},"unattributed":{"enabled":true}},"receive_receipts_enable":true}
[DefaultDispatcher-worker-5] HttpClient: POST apps/4e3455d0-10a6-xxxx-bc85-3f4afea449fd/users - FAILED STATUS: 400
[DefaultDispatcher-worker-5] HttpClient: POST RECEIVED JSON: {"errors":[{"title":"uuid: incorrect UUID length 42 in string \"local-df3ea23b-ff99-466a-84f1-71dd5ddb46a5\""}]}
[OpRepo] OperationRepo: execute response = FAIL_NORETRY
Operation execution failed without retry: [{"name":"login-user","appId":"4e3455d0-10a6-xxxx-bc85-3f4afea449fd","onesignalId":"local-7e897fc6-ef40-4734-bb71-1eac1949b680","id":"4d42a1c0-b434-4cde-b1e7-8e2b7cf5b63e"}, {"name":"transfer-subscription","appId":"4e3455d0-10a6-xxxx-bc85-3f4afea449fd","subscriptionId":"local-df3ea23b-ff99-466a-84f1-71dd5ddb46a5","onesignalId":"local-7e897fc6-ef40-4734-bb71-1eac1949b680","id":"17513b7e-cfec-4fc0-a954-891337a865e5"}]

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

AndreasBoehm avatar Nov 16 '23 07:11 AndreasBoehm

Hello @AndreasBoehm thank you for reaching out! We're investigating this and will get back to you as soon as possible.

jennantilla avatar Nov 16 '23 19:11 jennantilla

Hi @AndreasBoehm, sorry for the delay in following up.

I see in your logs you have these two lines that is the error response from the server:

[DefaultDispatcher-worker-5] HttpClient: POST apps/4e3455d0-10a6-xxxx-bc85-3f4afea449fd/users - FAILED STATUS: 400
[DefaultDispatcher-worker-5] HttpClient: POST RECEIVED JSON: {"errors":[{"title":"uuid: incorrect UUID length 42 in string \"local-df3ea23b-ff99-466a-84f1-71dd5ddb46a5\""}]}

That is the server response so before that, there should be logged the actual POST request that will looks something like this:

[DefaultDispatcher-worker-5] HttpClient: POST apps/4e3455d0-10a6-xxxx-bc85-3f4afea449fd/users - {"properties":{"language":"en".....}}

Do you have that information?

nan-li avatar Jan 24 '24 04:01 nan-li

Anyone have solution on above issue? please help...

sw-tt-jigarkumarpatel avatar Feb 27 '24 04:02 sw-tt-jigarkumarpatel

@AndreasBoehm @sw-tt-jigarkumarpatel we have made a number of improves to the SDK around this code. Can you try the latest SDK (5.1.8 at the time of writing) and let us know if it fixes it for you?

jkasten2 avatar Apr 10 '24 02:04 jkasten2

@jkasten2 I am running into this issue on 5.1.14. At one point today I got 1 IAM to show at app start up (should show every time, but since then nothing.

Here is a bit of log: [main] initWithContext: creating new device-scoped user D [main] createAndSwitchToNewUser() D [main] Retrieving service interface com.onesignal.core.internal.application.IApplicationService D [main] Already instantiated: com.onesignal.core.internal.application.impl.ApplicationService@f4c6723 D [main] Retrieving service interface com.onesignal.core.internal.application.IApplicationService D [main] Already instantiated: com.onesignal.core.internal.application.impl.ApplicationService@f4c6723 D [main] OperationRepo.enqueue(operation: {"name":"transfer-subscription","appId":"d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a","subscriptionId":"local-b826441f-e2ca-43ed-b6b4-24b532ed2951","onesignalId":"local-8dd0b9c1-e288-4b45-af0b-03440ca42c93"}, flush: false) D [main] OperationRepo.enqueue(operation: {"name":"login-user","appId":"d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a","onesignalId":"local-8dd0b9c1-e288-4b45-af0b-03440ca42c93"}, flush: false) D [Thread-7] ConfigModelListener: fetching parameters for appId: d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a D [Thread-7] ParamsBackendService.fetchParams(appId: d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a, subscriptionId: null) D [main] NotificationsManager.addPermissionObserver(observer: D [DefaultDispatcher-worker-1] HttpClient: Request Sent = GET https://api.onesignal.com/apps/d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a/android_params.js - Body: null - Headers: Accept=[application/vnd.onesignal.v1+json], OneSignal-Install-Id=[43a8bbc5-798d-421a-a9fc-c82cec349e1e], OneSignal-Subscription-Id=[local-b826441f-e2ca-43ed-b6b4-24b532ed2951], SDK-Version=[onesignal/android/050114] D [DefaultDispatcher-worker-1] HttpClient: Adding header if-none-match: W/"cdd3c2d91a7c61abd8ae64fe8b40f99c" D [main] InAppMessagesManager.addLifecycleListener(listener: ) D [main] InAppMessagesManager.addClickListener(listener: D [main] NotificationsManager.addClickListener(handler: ) D [DefaultDispatcher-worker-2] Attempted to clean 6 month old IAM data, but none exists! D [main] NotificationsManager.addForegroundLifecycleListener(listener: ) D [OpRepo] OperationRepo: internalEnqueue - operation.id: cd815288-6af0-4ce9-a612-9ae002bef767 already exists in the queue. D [OpRepo] OperationRepo: internalEnqueue - operation.id: 2510fd2a-7fc1-4671-9684-0bbcbf9b0639 already exists in the queue. D [DefaultDispatcher-worker-1] HttpClient: Got Response = GET https://api.onesignal.com/apps/d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a/android_params.js - STATUS: 200 - Body: {"awl_list":{},"android_sender_id":"844679614172","chnl_lst":[],"enterp":true,"fba":true,"outcomes":{"direct":{"enabled":false},"indirect":{"notification_attribution":{"minutes_since_displayed":60,"limit":10},"enabled":false},"unattributed":{"enabled":false}},"receive_receipts_enable":true} D [DefaultDispatcher-worker-1] HttpClient: Got Response = Response has etag of W/"4f8677d532c938348539aad8022fc5c0" so caching the response. D [OpRepo] processQueueForever:ops: [bucket:0, retries:0, operation:{"name":"login-user","appId":"d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a","onesignalId":"local-8dd0b9c1-e288-4b45-af0b-03440ca42c93","id":"cd815288-6af0-4ce9-a612-9ae002bef767"} , bucket:0, retries:0, operation:{"name":"transfer-subscription","appId":"d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a","subscriptionId":"local-b826441f-e2ca-43ed-b6b4-24b532ed2951","onesignalId":"local-8dd0b9c1-e288-4b45-af0b-03440ca42c93","id":"2510fd2a-7fc1-4671-9684-0bbcbf9b0639"} ] D [OpRepo] LoginUserOperationExecutor(operation: [{"name":"login-user","appId":"d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a","onesignalId":"local-8dd0b9c1-e288-4b45-af0b-03440ca42c93","id":"cd815288-6af0-4ce9-a612-9ae002bef767"}, {"name":"transfer-subscription","appId":"d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a","subscriptionId":"local-b826441f-e2ca-43ed-b6b4-24b532ed2951","onesignalId":"local-8dd0b9c1-e288-4b45-af0b-03440ca42c93","id":"2510fd2a-7fc1-4671-9684-0bbcbf9b0639"}]) D [DefaultDispatcher-worker-3] HttpClient: Request Sent = POST https://api.onesignal.com/apps/d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a/users - Body: {"subscriptions":[{"id":"local-b826441f-e2ca-43ed-b6b4-24b532ed2951"}],"properties":{"timezone_id":"America/Los_Angeles","language":"en"},"refresh_device_metadata":true} - Headers: Accept=[application/vnd.onesignal.v1+json], Content-Type=[application/json; charset=UTF-8], OneSignal-Install-Id=[43a8bbc5-798d-421a-a9fc-c82cec349e1e], OneSignal-Subscription-Id=[local-b826441f-e2ca-43ed-b6b4-24b532ed2951], SDK-Version=[onesignal/android/050114] D [DefaultDispatcher-worker-3] HttpClient: Got Response = POST https://api.onesignal.com/apps/d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a/users - FAILED STATUS: 400 W [DefaultDispatcher-worker-3] HttpClient: Got Response = POST - STATUS: 400 - Body: {"errors":[{"title":"uuid: incorrect UUID length 42 in string "local-b826441f-e2ca-43ed-b6b4-24b532ed2951""}]} D [OpRepo] OperationRepo: execute response = FAIL_PAUSE_OPREPO E Operation execution failed with eventual retry, pausing the operation repo: [{"name":"login-user","appId":"d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a","onesignalId":"local-8dd0b9c1-e288-4b45-af0b-03440ca42c93","id":"cd815288-6af0-4ce9-a612-9ae002bef767"}, {"name":"transfer-subscription","appId":"d7dcf2a4-e32b-4cb4-9089-c81fbdb1bf3a","subscriptionId":"local-b826441f-e2ca-43ed-b6b4-24b532ed2951","onesignalId":"local-8dd0b9c1-e288-4b45-af0b-03440ca42c93","id":"2510fd2a-7fc1-4671-9684-0bbcbf9b0639"}] D [OpRepo] retryAfterSeconds: null

Any additional information would be helpful!

if (oneSignalAppId != null) { OneSignal.Debug.logLevel = LogLevel.VERBOSE if(!OneSignal.isInitialized) { val LOG_TAG = "OneSignal-sdk" OneSignal.consentGiven = true OneSignal.initWithContext(application, oneSignalAppId) } }

SDK 5.1.14 Kotlin 1.9.22 Android API 34

chrisagay avatar Jun 11 '24 02:06 chrisagay

@chrisagay do you use identity verification?

Apparently, it is not supported yet in v5.x.x even though the method is there... I spend so much time trying to figure this out!

zvikarp avatar Jun 13 '24 06:06 zvikarp

I am closing my issue now as we are planning to move to a different platform and stick to OneSignal 4.X for now.

AndreasBoehm avatar Jun 13 '24 06:06 AndreasBoehm

I figured out my issue, we were calling initWithContext mulitple times with different appId. Our iOS team has access to the setAppId() which can be called after initWithLaunchOptions(), which also matches 4.x.x. After adjusting to call initWithContext() once resolved the issue, but it would be nice to be able to set the app ID separately and/or switch app id's.

On Wed, Jun 12, 2024, 11:35 PM Andreas Böhm @.***> wrote:

I am closing my issue now as we are planning to move to a different platform and stick to OneSignal 4.X for now.

— Reply to this email directly, view it on GitHub https://github.com/OneSignal/OneSignal-Android-SDK/issues/1913#issuecomment-2164620087, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZEBVZ6A66YQCZYOSRP7LDZHE4UFAVCNFSM6AAAAAA7NWEXZ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRUGYZDAMBYG4 . You are receiving this because you were mentioned.Message ID: @.***>

chrisagay avatar Jun 13 '24 13:06 chrisagay

I should also note I had to clear my data

On Thu, Jun 13, 2024, 6:02 AM Christopher Gay @.***> wrote:

I figured out my issue, we were calling initWithContext mulitple times with different appId. Our iOS team has access to the setAppId() which can be called after initWithLaunchOptions(), which also matches 4.x.x. After adjusting to call initWithContext() once resolved the issue, but it would be nice to be able to set the app ID separately and/or switch app id's.

On Wed, Jun 12, 2024, 11:35 PM Andreas Böhm @.***> wrote:

I am closing my issue now as we are planning to move to a different platform and stick to OneSignal 4.X for now.

— Reply to this email directly, view it on GitHub https://github.com/OneSignal/OneSignal-Android-SDK/issues/1913#issuecomment-2164620087, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZEBVZ6A66YQCZYOSRP7LDZHE4UFAVCNFSM6AAAAAA7NWEXZ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRUGYZDAMBYG4 . You are receiving this because you were mentioned.Message ID: @.***>

chrisagay avatar Jun 13 '24 13:06 chrisagay