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]: Sending push notification to wrong user #258

Closed
HoangDilo opened this issue Apr 24, 2024 · 7 comments
Closed

[Bug]: Sending push notification to wrong user #258

HoangDilo opened this issue Apr 24, 2024 · 7 comments
Labels

Comments

@HoangDilo
Copy link

Which Platforms?

iOS

Which React Native Version?

0.73.5

Which @braze/react-native-sdk SDK version?

9.0.0

Repro Rate

Really hight, especially after switching users

Steps To Reproduce

Example:

  1. import Braze from "@braze/react-native-sdk".
  2. Run the app
  3. //some logics for creating anonymous users (haven't logged in)
  4. const deviceId = DeviceInfo.getUniqueId();
  5. run: Braze.changeUser(anonymous_${deviceId})
  6. //set attributes of an anonymous user to Braze (both standard and custom attributes)
  7. //login first account, calling apis to get the UserId_1
  8. run: Braze.changeUser(UserId_1)
  9. //set attributes of an User to Braze (both standard and custom attributes)
  10. //Logout logic
  11. const anonymousId = AsyncStorage.getItem('anonymous_id') //get back the anonymous user id from storage
  12. //switch back to anonymous users and run: Braze.changeUser(anonymousId)
  13. //set attributes of an anonymous user to Braze (both standard and custom attributes)
  14. //Login with second account, calling apis to get the UserId_2
  15. run: Braze.changeUser(UserId_2)
  16. Creating test push notification, sending to the changed user

Expected Behavior

  • Receive the test push notification (correspoding with the current user that is logging in)
  • Seeing error message: "No matching token..." when trying to push the notification to UserIds not being used

Actual Incorrect Behavior

  • NOT receive the test push notification for the that is logging in.
  • Receive test push notification of OTHER user

Verbose Logs

No response

Additional Information

  • I have tried to debug this bug, even try to log the current userId from Braze (with Braze.getUserId) after each switching phase. The userId return is correct (receive correct logged in user Id and correct anonymous user id)
  • I also monitor the payload has been sent to Braze via sdk, and the user id sent to Braze is correct too
  • Until now, this bug only appears on IOS actual devices, after me switching the user many times
@HoangDilo HoangDilo added the bug label Apr 24, 2024
@hokstuff
Copy link
Collaborator

Hi @HoangDilo,

Can you contact [email protected] with more information:

  • Please attach verbose logs when you are able to reproduce this issue
  • Are you able to reproduce this with actual campaign sends (instead of Test Sends)?
  • Can you repro this with our React Native sample app?
  • At times, it may take a little bit for APNs to send a push notification that is received on a device. It may help to try again after some time if you feel that the notifications take a long time to be received by the device
  • Add a link to this Github issue for reference

The Braze Support team should help with trying to reproduce this issue to diagnose the root cause.

Thanks!

@wangbf11
Copy link

我也遇到同样的问题(I also encountered the same problem) Hope to resolve it quickly

@HoangDilo
Copy link
Author

HoangDilo commented May 30, 2024

For people who encounter this issue, we could fix it by manually configuring the IOS token. But it's kinda complicated

@wangbf11
Copy link

For people who encounter this issue, we could fix it by manually configuring the IOS token. But it's kinda complicated

我已经解决了 哈哈今天困扰了我 1天了。抓包发现切换userid的时候 安卓发送了请求 ios没发送 ios有点不同 你要去 原生力把token拿到 传到rn来 然后 changeUser后 再注册一次registerPushToken 我抓包看到请求就正常了

@jerielng
Copy link
Collaborator

@wangbf11 @HoangDilo Just to check, in your iOS code, are you implementing push functionality via configuration.push.automation, or the manual integration? It might be related to an issue that was recently fixed in 9.2.0 of our Swift SDK, which is pending an upcoming port to our React Native SDK.

@wangbf11
Copy link

@wangbf11 @HoangDilo只需检查一下,在您的 iOS 代码中,您是通过 还是手动集成实现推送功能?这可能与我们 Swift SDK 9.2.0configuration.push.automation中最近修复的问题有关,该问题正在等待即将移植到我们的 React Native SDK。

ios的changeuse 不会触发 userId和pushtoken的绑定关系 需要手动调用registerPushToken(i参数:ios原生token)。

@jerielng
Copy link
Collaborator

Hey all, the latest 10.0.0 version has been updated with our underlying Swift SDK version 12.0.0. This fix contains updates that upload push tokens more reliably when using the push automation features, particularly on changing users.

If you continue to see issues after upgrading, please send in some verbose logs and reproduction steps (in addition to code snippets of how you are integrating push notifications with our SDK) to [email protected]. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants