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

[Bug]: console shows PATCH request with 409 Conflict result after cache clear (160001)

Open lmeurs opened this issue 2 years ago • 4 comments

What happened?

The first time a page with our OneSignal implementation is loaded after clearing browser cache + cookies, the console shows a 409 Conflict error:

OneSignalApiBase.js:67 PATCH https://onesignal.com/api/v1/apps/800f295a-a6b2-49c9-9fb1-2555e1e8df91/users/by/onesignal_id/e99029ac-39b1-459c-9409-0b5c48cb78ab/identity 409

image

The URL shows the following message:

{"errors":[{"title":"No aliases found for oneSignalID e99029ac-39b1-459c-9409-0b5c48cb78ab"}]}

Our test OneSignal account only contains 4 subscriptions, none of them indeed has OneSignal ID e99029ac-39b1-459c-9409-0b5c48cb78ab. Sidenotes:

  1. The error no longer occurs after reloading the page
  2. The OneSignal ID changes each time when reproducing this

What browsers are you seeing the problem on?

Chrome (Chromium)

What operating system are you running?

W11

Steps to reproduce?

See description

What did you expect to happen?

No error

Relevant log output

No response

lmeurs avatar Aug 18 '23 14:08 lmeurs

@lmeurs Thanks for reporting!

Looking to get a few more details to reproduce this issue:

  1. Does the error only happen after calling OneSignal.User.addAlias?
  2. Does it happen consistently?
  1. The OneSignal ID changes each time when reproducing this

To answer your question on this, it is expected to get a new id each time the browser's cache and cookie / data is cleared. Since there is nothing in the browser left to know it is the same user.

jkasten2 avatar Aug 18 '23 18:08 jkasten2

Hi @jkasten2, this indeed seems to happen consistently.

The user is logged in successfully using OneSignal.login(123456). See screenshot: after the user logs in we do not query OneSignal users (on purpose at least), we only initialize the user by requesting an own API. That the 409 error is between two log messages about initializing the user is probably due to a promise being resolved asynchronously (see Notifications.prototype.apiRequestToInitNotificationUser in /js/notifications.js of the POC we shared with you).

image

You say:

[...] there is nothing in the browser left to know it is the same user

But we log the user in with an external ID, so the browser should be able to know the correct OneSignal user ID, but appears to lookup the user with a completely different OneSignal user ID which does not represent any user in our account. Heck, we currently only have 1 user in our test account with a different user ID. :-)

lmeurs avatar Aug 20 '23 20:08 lmeurs

Hi @jkasten2, is there anything else we can do to help you investigate this issue?

lmeurs avatar Aug 29 '23 09:08 lmeurs