braze-react-native-sdk
braze-react-native-sdk copied to clipboard
[Bug]: Sending push notification to wrong user
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:
- import Braze from "@braze/react-native-sdk".
- Run the app
- //some logics for creating anonymous users (haven't logged in)
- const deviceId = DeviceInfo.getUniqueId();
- run:
Braze.changeUser(
anonymous_${deviceId})
- //set attributes of an anonymous user to Braze (both standard and custom attributes)
- //login first account, calling apis to get the UserId_1
- run:
Braze.changeUser(UserId_1)
- //set attributes of an User to Braze (both standard and custom attributes)
- //Logout logic
- const anonymousId = AsyncStorage.getItem('anonymous_id') //get back the anonymous user id from storage
- //switch back to anonymous users and run: Braze.changeUser(anonymousId)
- //set attributes of an anonymous user to Braze (both standard and custom attributes)
- //Login with second account, calling apis to get the UserId_2
- run:
Braze.changeUser(UserId_2)
- 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
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!
我也遇到同样的问题(I also encountered the same problem) Hope to resolve it quickly
For people who encounter this issue, we could fix it by manually configuring the IOS token. But it's kinda complicated
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 我抓包看到请求就正常了
@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 @HoangDilo只需检查一下,在您的 iOS 代码中,您是通过 还是手动集成实现推送功能?这可能与我们 Swift SDK 9.2.0
configuration.push.automation
中最近修复的问题有关,该问题正在等待即将移植到我们的 React Native SDK。
ios的changeuse 不会触发 userId和pushtoken的绑定关系 需要手动调用registerPushToken(i参数:ios原生token)。
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!