OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
606 stars 204 forks source link

ERROR: OSPropertyOperationExecutor update properties request failed with error: Optional(Error Domain=OneSignalError Code=429 "(null)" #858

Closed ihijazi closed 1 month ago

ihijazi commented 3 months ago

What happened?

Hello

I'm using OneSignal flutter SDK

In debug mode, in xcode debug console, I see hundreds of the following being logged:

ERROR: OSPropertyOperationExecutor update properties request failed with error: Optional(Error Domain=OneSignalError Code=429 "(null)" UserInfo={returned={
    errors =     (
        "API rate limit exceeded"
    );
    httpStatusCode = 429;
    limit = "Subscription/User Update Per Device";
}})

Even when I removed OneSignal altogether, not calling initialize, I still see them. It's driving me crazy!

I did setLogLevel at the beginning to verbos, but nothing relevant about why this is showing up.

I can share the log but not sure it's best to do here as it has some identifying details in many areas.

Steps to reproduce?

SDK version 5.1.2
iOS 17.3.1
Flutter version 3.19.3
Physical device iPhone 12 Pro

What did you expect to happen?

Not to see this. I'm not sure why this is showing up.

Notification is working fine.

OneSignal Flutter SDK version

5.1.2

Which platform(s) are affected?

Relevant log output

No response

Code of Conduct

nan-li commented 3 months ago

Hi @ihijazi, thank you for reporting.

The OneSignal Flutter SDK will have some activity as long as you have initialized it at some point during an installation of an application, even when you do not call OneSignal.initialize on future cold starts.

I am surprised that you are seeing hundreds of these. The error log you reported is printed when a request returned a 429 status. Can you share any logs that look like the following:

VERBOSE: HTTP Request (OneSignalUser.OSRequestUpdateProperties) with URL: https://api.onesignal.com/apps/<APP_ID>/users/by/onesignal_id/<ONESIGNAL_ID>, with parameters: {
  "foo" : {
      ...
  },
  "bar" : true,
  "baz" : "blahblah"
}

These are the requests the SDK is making that is receiving the 429 response. That will help us figure out what information the SDK is trying to send.

ihijazi commented 3 months ago

Thanks @nan-li for getting back to me.

shall I do here? And if so, shall I remove the app_id and onesignal_id?

ihijazi commented 3 months ago

Here is an extract of something similar to what you're asking. I've replaced app id and onesignal id with dummy string.

Task <B405791F-AB72-4A55-AF36-80956BCFB11A>.<9939> HTTP load failed, 422/235 bytes (error code: -1005 [4:-4])

Task <B405791F-AB72-4A55-AF36-80956BCFB11A>.<9939> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x28b02cae0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x2802ce040 [0x206a986a8]>{length = 28, capacity = 28, bytes = 0x1c1e01bb000000002606470000000000 ... 6812d63b00000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <B405791F-AB72-4A55-AF36-80956BCFB11A>.<9939>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <B405791F-AB72-4A55-AF36-80956BCFB11A>.<9939>"
), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://api.onesignal.com/apps/appid/users/by/onesignal_id/someid, NSErrorFailingURLKey=https://api.onesignal.com/apps/appid/users/by/onesignal_id/someid, _kCFStreamErrorDomainKey=4}

ERROR: OSPropertyOperationExecutor update properties request failed with error: Optional(Error Domain=OneSignalError Code=429 "(null)" UserInfo={error=Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x28b02cae0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x2802ce040 [0x206a986a8]>{length = 28, capacity = 28, bytes = 0x1c1e01bb000000002606470000000000 ... 6812d63b00000000}, _kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <B405791F-AB72-4A55-AF36-80956BCFB11A>.<9939>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <B405791F-AB72-4A55-AF36-80956BCFB11A>.<9939>"
), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://api.onesignal.com/apps/appid/users/by/onesignal_id/someid, NSErrorFailingURLKey=https://api.onesignal.com/apps/appid/users/by/onesignal_id/someid, _kCFStreamErrorDomainKey=4}})
Task <593F13EF-93F3-4E2C-874B-F5D23034518C>.<10513> finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2103, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <593F13EF-93F3-4E2C-874B-F5D23034518C>.<10513>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <593F13EF-93F3-4E2C-874B-F5D23034518C>.<10513>"
), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=https://api.onesignal.com/apps/appid/users/by/onesignal_id/someid, NSErrorFailingURLKey=https://api.onesignal.com/apps/appid/users/by/onesignal_id/someid, _kCFStreamErrorDomainKey=4}

Task <E610ECEC-0A60-49F7-9789-6A1C214AB5B2>.<10514> finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2103, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <E610ECEC-0A60-49F7-9789-6A1C214AB5B2>.<10514>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <E610ECEC-0A60-49F7-9789-6A1C214AB5B2>.<10514>"
), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=https://api.onesignal.com/apps/appid/users/by/onesignal_id/someid, NSErrorFailingURLKey=https://api.onesignal.com/apps/appid/users/by/onesignal_id/someid, _kCFStreamErrorDomainKey=4}

But the error I mentioned before happens before this shows in the log at different point of times.

Couldn't read values in CFPrefsPlistSource<0x2814dcea0> (Domain: group.com.xx.yy.zz.onesignal, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd

[ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend.
flutter: The Dart VM service is listening on http://0.0.0.0:59162/WcKWZ5kP8f8=/

[ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend.

CFPrefsPlistSource<0x2814dcd80> (Domain: group.com.xx.yy.zz.onesignal, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): Attempting to store >= 4194304 bytes of data in CFPreferences/NSUserDefaults on this platform is invalid. This is a bug in Runner or a library it uses.
<decode: bad range for [%@] got [offs:539 len:826 within:0]>
Not updating lastKnownShmemState in CFPrefsPlistSource<0x2814dcd80> (Domain: group.com.xx.yy.zz.onesignal, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): 20080 -> 20080
CFPrefsPlistSource<0x2814dcd80> (Domain: group.com.xx.yy.zz.onesignal, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): Transitioning into direct mode
Source was stale because shmem was null: CFPrefsPlistSource<0x2814dcd80> (Domain: group.com.xx.yy.zz.onesignal, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes)
Source was stale because shmem was null: CFPrefsPlistSource<0x2814dcd80> (Domain: group.com.xx.yy.zz.onesignal, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes)
ihijazi commented 3 months ago

hey mate @nan-li any update? Is there another place where I can/should report this?

nan-li commented 2 months ago

Hi @ihijazi sorry for the delay, I am not sure how to process your information.

You share errors about the network connection being lost, but the 429 error you shared is a response from OneSignal servers so the request is getting through.

I am looking for something that says VERBOSE: HTTP Request (OneSignalUser.OSRequestUpdateProperties) with URL... as this contains the information that is being sent, and then the SDK receives a 429 in response. Do you see that exact log?

Can you also share how your app interacted with the SDK that led to this situation, if you remember?

ihijazi commented 2 months ago

Hi @nan-li

For whatever reason, the problem is not there anymore. Nothing changed on the app logic or network, etc.

Current version is updated to 5.1.3 now. So must be something you guys fixed?

nan-li commented 1 month ago

Hi @ihijazi that is good to hear, but perplexing why you stopped encountering this, as nothing was added in 5.1.3 that should be related to this issue.

ihijazi commented 1 month ago

@nan-li it's on 5.1.6 now. I'll close this. Thanks for now.