[Bug]: Login sometime not working on iOS and HTTP Client Error with status code: 500
What happened?
On the latest version of the Flutter OneSignal SDK, I think the login function doesn't work on some devices. The patch request https://api.onesignal.com/apps/APPID/users/by/onesignal_id/ONESIGNALID gets a 500 request on some iOS devices. In the OneSignal dashboard you can see that login sometimes does not work. I think this is related.`
Steps to reproduce?
1. Install latest OneSignal Flutter SDK
2. Use this Code: (I am useing the Qonversion User ID which is working on Android and on some iOS Devices) This ID is a normal String
Init in main:
OneSignal.Debug.setLogLevel(isTestMode ? OSLogLevel.verbose : OSLogLevel.none);
OneSignal.consentRequired(true);
OneSignal.initialize(ID);
In the Func to start the prompt
await OneSignal.consentGiven(true);
QUser qonID = await Qonversion.getSharedInstance().userInfo();
// ignore: unnecessary_string_interpolations
await OneSignal.login("${qonID.qonversionId.toString()}");
await OneSignal.Notifications.requestPermission(true);
What did you expect to happen?
The External ID is set correctly and the user don't get a 500 Response Code
OneSignal Flutter SDK version
onesignal_flutter: ^5.2.2
Which platform(s) are affected?
- [X] iOS
- [ ] Android
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
@FantaMagier could you share the exact payload from the xcode log that is getting the 500 error? You may have to enable OneSignal verbose logging.
@jkasten2 I got the following logs:
VERBOSE: HTTP Request (OneSignalUser.OSRequestIdentifyUser) with URL: https://api.onesignal.com/apps/APPID/users/by/onesignal_id/ONESIGNALID/identity, with parameters: {
"identity" : {
"external_id" : "QON_54eb6b1ca96d419babc4efa1cfe3ed3e"
}
}
[Sentry] [debug] [SentryNetworkTracker:390] Response status code isn't within the allowed ranges, not capturing HTTP Client errors.
VERBOSE: network response (OSRequestGetInAppMessages) with URL https://api.onesignal.com/apps/APPID/subscriptions/NUM/iams: {
httpStatusCode = 200;
"in_app_messages" = (
);
}
VERBOSE: getInAppMessagesFromServer success
VERBOSE: updateInAppMessagesFromServer
[Sentry] [debug] [SentryScope:125] Add breadcrumb: <SentryBreadcrumb: 0x3018df240, {
category = http;
data = {
method = GET;
reason = "no error";
"request_body_size" = 0;
"response_body_size" = 22;
"status_code" = 200;
url = "https://api.onesignal.com/apps/APPID/subscriptions/SUBNUM/iams";
};
level = info;
timestamp = "2024-07-19T04:08:19.108Z";
type = http;
}>
Hi @FantaMagier, it seems your log cut out key information. I see the 200 success response the SDK makes to fetch in app messages from the server. I don't see the 500 error.
Closing due to no response. @FantaMagier if this is still an issue on the latest SDK version, please provide an updated log with the 500 error and we'll be happy to take a look.