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]: Not handling unsupported languages gracefully #1329

Closed
1 task done
magtastic opened this issue Oct 26, 2023 · 5 comments
Closed
1 task done

[Bug]: Not handling unsupported languages gracefully #1329

magtastic opened this issue Oct 26, 2023 · 5 comments
Labels

Comments

@magtastic
Copy link

magtastic commented Oct 26, 2023

What happened?

Calling https://api.onesignal.com/apps/<APP_ID>/users with parameters {..."properties":{...,"language": "is-IS"}} results in

ERROR: OSUserExecutor create user request failed with error: Optional(Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={
    errors =     (
                {
            title = "The provided language value is not a supported ISO 639-1 value";
        }
    );
    httpStatusCode = 400;
}})

Trying to login again results in

VERBOSE: OneSignal.User login called with externalId: fake_external_user_id_7
VERBOSE: OneSignalUserManager internal _login called with externalId: fake_external_user_id_7
VERBOSE: OneSignalUserManager.createNewUser: not creating new user due to logging into the same user.)

but the user is not present on the OneSignal dashboard, nor does he have a subscriptionId.

Steps to reproduce?

Encountered this via the react native SDK. So;
1. Create a new react native project with `npx create-expo-app one_signal_example`
2. run `npx expo install expo-dev-client`
3. Setup OneSignal according to documentation here: https://documentation.onesignal.com/docs/react-native-expo-sdk-setup
4. Set default language on iOS device as Icelandic and run the app on the device

What did you expect to happen?

I expect the server to know that Icelandic has a valid ISO 639-1 code (see: https://en.wikipedia.org/wiki/ISO_639).

I would also expect the error handled better on the client side, e.g. defaulting to english.

OneSignal iOS SDK version

5.0.2

iOS version

13

Specific iOS version

Tried this on iOS `17.0.3`

Relevant log output

Running "main" with {"rootTag":11,"initialProps":{}}
initOneSignal
VERBOSE: setAppId called with appId: 3e6ee5a8-e283-4581-9f8d-f0830c633825!
DEBUG: provision: {
    AppIDName = "theonetheone ee256bd2268fc933662faaa47138d15c";
    ApplicationIdentifierPrefix =     (
        MJZV368WRA
    );
    CreationDate = "2023-09-04 11:36:47 +0000";
    "DER-Encoded-Profile" = {length = 4214, bytes = 0x30821072 06092a86 4886f70d 010702a0 ... f1318f45 1b65d921 };
    DeveloperCertificates =     (
        {length = 1487, bytes = 0x308205cb 308204b3 a0030201 02021028 ... e333d204 683cf727 },
        {length = 1497, bytes = 0x308205d5 308204bd a0030201 02021048 ... 2d581116 a8a319fe },
        {length = 1490, bytes = 0x308205ce 308204b6 a0030201 02021032 ... 10d205b7 ffd14279 },
        {length = 1490, bytes = 0x308205ce 308204b6 a0030201 0202102c ... 8712f6af 2a4a0fed },
        {length = 1488, bytes = 0x308205cc 308204b4 a0030201 0202101b ... 496709d0 1d4db450 },
        {length = 1484, bytes = 0x308205c8 308204b0 a0030201 02021041 ... 65d88d2e 80cded4e },
        {length = 1484, bytes = 0x308205c8 308204b0 a0030201 02021027 ... c2e557cc eed20582 }
    );
    Entitlements =     {
        "application-identifier" = "MJZV368WRA.com.theone.theoneapp";
        "aps-environment" = development;
        "com.apple.developer.applesignin" =         (
            Default
        );
        "com.apple.developer.associated-domains" = "*";
        "com.apple.developer.team-identifier" = MJZV368WRA;
        "com.apple.security.application-groups" =         (
            "group.com.theone.theoneapp.onesignal"
        );
        "get-task-allow" = 1;
        "keychain-access-groups" =         (
            "MJZV368WRA.*",
            "com.apple.token"
        );
    };
    ExpirationDate = "2024-09-03 11:36:47 +0000";
    IsXcodeManaged = 1;
    Name = "iOS Team Provisioning Profile: com.theone.theoneapp";
    Platform =     (
        iOS,
        xrOS,
        visionOS
    );
    ProvisionedDevices =     (
        "00008110-001A25983E43801E",
        "00008101-001E28D11AB9003A",
        "00008110-001C3D99263A401E",
        "00008030-001110C60A81802E",
        ffe04d5010536aab8371081b1323a94b32a1550a,
        "00008030-000270292668802E",
        "00008101-001E4DDE2652001E",
        "00008101-001A69E80EF1001E",
        da154c0ff38b9d07e48625be4e74f19d1e952eef,
        "00008101-00015D0A0EFA001E",
        "00008101-000869D214C2001E",
        "00008103-001D442A0A9A001E",
        "00006000-001251DC2238801E"
    );
    TeamIdentifier =     (
        MJZV368WRA
    );
    TeamName = "Smitten ehf.";
    TimeToLive = 365;
    UUID = "24cd1df2-3f4e-4d37-a01e-18aff1550820";
    Version = 1;
}
VERBOSE: OneSignalUserManagerImpl prepareForNewUser called
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationIconBadgeNumber]
PID: 4851, TID: 1498188, Thread name: (none), Queue name: com.facebook.react.OneSignalQueue, QoS: 0
Backtrace:
4   OneSignalNotifications              0x0000000105a5e390 +[OSNotificationsManager clearBadgeCount:] + 124
5   OneSignalFramework                  0x00000001054284b8 +[OneSignal init] + 540
6   onesignalexample                    0x000000010304380c -[RCTOneSignalEventEmitter initialize:] + 76
7   CoreFoundation                      0x0000000195d6f134 CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 205108
8   CoreFoundation                      0x0000000195d6ebcc CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 203724
9   CoreFoundation                      0x0000000195d6e9f4 CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 203252
10  onesignalexample                    0x0000000102c1e354 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1808
11  onesignalexample                    0x0000000102c22284 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBAL__N_117SchedulingContextE + 1688
12  onesignalexample                    0x0000000102c21a20 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 128
13  onesignalexample                    0x0000000102c21994 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
14  libdispatch.dylib                   0x0000000105ce0f50 _dispatch_call_block_and_release + 32
15  libdispatch.dylib                   0x0000000105ce2b34 _dispatch_client_callout + 20
16  libdispatch.dylib                   0x0000000105cea98c _dispatch_lane_serial_drain + 832
17  libdispatch.dylib                   0x0000000105ceb728 _dispatch_lane_invoke + 408
18  libdispatch.dylib                   0x0000000105cf85f8 _dispatch_root_queue_drain_deferred_wlh + 328
19  libdispatch.dylib                   0x0000000105cf7c2c _dispatch_workloop_worker_thread + 444
20  libsystem_pthread.dylib             0x00000001fef2a964 _pthread_wqthread + 288
21  libsystem_pthread.dylib             0x00000001fef2aa04 start_wqthread + 8
VERBOSE: setLaunchOptions() called with launchOptions: (null)!
VERBOSE: launchOptions is set and appId of 3e6ee5a8-e283-4581-9f8d-f0830c633825 is set, initializing OneSignal...
VERBOSE: Firing registerForRemoteNotifications
DEBUG: Downloading iOS parameters for this application
VERBOSE: oneSignalDidRegisterForRemoteNotifications:deviceToken:
INFO: Device Registered with Apple: 62c6cac0e5f7d57d2a4705adcc97ea5c3085973d73d449f5ac596ddb1698fbbd
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationIconBadgeNumber]
PID: 4851, TID: 1498188, Thread name: (none), Queue name: com.facebook.react.OneSignalQueue, QoS: 0
Backtrace:
4   OneSignalNotifications              0x0000000105a5e390 +[OSNotificationsManager clearBadgeCount:] + 124
5   OneSignalFramework                  0x00000001054284b8 +[OneSignal init] + 540
6   onesignalexample                    0x000000010304380c -[RCTOneSignalEventEmitter initialize:] + 76
7   CoreFoundation                      0x0000000195d6f134 CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 205108
8   CoreFoundation                      0x0000000195d6ebcc CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 203724
9   CoreFoundation                      0x0000000195d6e9f4 CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 203252
10  onesignalexample                    0x0000000102c1e354 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1808
11  onesignalexample                    0x0000000102c22284 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBAL__N_117SchedulingContextE + 1688
12  onesignalexample                    0x0000000102c21a20 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 128
13  onesignalexample                    0x0000000102c21994 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
14  libdispatch.dylib                   0x0000000105ce0f50 _dispatch_call_block_and_release + 32
15  libdispatch.dylib                   0x0000000105ce2b34 _dispatch_client_callout + 20
16  libdispatch.dylib                   0x0000000105cea98c _dispatch_lane_serial_drain + 832
17  libdispatch.dylib                   0x0000000105ceb728 _dispatch_lane_invoke + 408
18  libdispatch.dylib                   0x0000000105cf85f8 _dispatch_root_queue_drain_deferred_wlh + 328
19  libdispatch.dylib                   0x0000000105cf7c2c _dispatch_workloop_worker_thread + 444
20  libsystem_pthread.dylib             0x00000001fef2a964 _pthread_wqthread + 288
21  libsystem_pthread.dylib             0x00000001fef2aa04 start_wqthread + 8
VERBOSE: registering for Application Lifecycle notifications
VERBOSE: OneSignalUserManager calling start
VERBOSE: OSOperationRepo calling start()
VERBOSE: OneSignalUserManager internal _login called with externalId: nil
DEBUG: provision: {
    AppIDName = "theonetheone ee256bd2268fc933662faaa47138d15c";
    ApplicationIdentifierPrefix =     (
        MJZV368WRA
    );
    CreationDate = "2023-09-04 11:36:47 +0000";
    "DER-Encoded-Profile" = {length = 4214, bytes = 0x30821072 06092a86 4886f70d 010702a0 ... f1318f45 1b65d921 };
    DeveloperCertificates =     (
        {length = 1487, bytes = 0x308205cb 308204b3 a0030201 02021028 ... e333d204 683cf727 },
        {length = 1497, bytes = 0x308205d5 308204bd a0030201 02021048 ... 2d581116 a8a319fe },
        {length = 1490, bytes = 0x308205ce 308204b6 a0030201 02021032 ... 10d205b7 ffd14279 },
        {length = 1490, bytes = 0x308205ce 308204b6 a0030201 0202102c ... 8712f6af 2a4a0fed },
        {length = 1488, bytes = 0x308205cc 308204b4 a0030201 0202101b ... 496709d0 1d4db450 },
        {length = 1484, bytes = 0x308205c8 308204b0 a0030201 02021041 ... 65d88d2e 80cded4e },
        {length = 1484, bytes = 0x308205c8 308204b0 a0030201 02021027 ... c2e557cc eed20582 }
    );
    Entitlements =     {
        "application-identifier" = "MJZV368WRA.com.theone.theoneapp";
        "aps-environment" = development;
        "com.apple.developer.applesignin" =         (
            Default
        );
        "com.apple.developer.associated-domains" = "*";
        "com.apple.developer.team-identifier" = MJZV368WRA;
        "com.apple.security.application-groups" =         (
            "group.com.theone.theoneapp.onesignal"
        );
        "get-task-allow" = 1;
        "keychain-access-groups" =         (
            "MJZV368WRA.*",
            "com.apple.token"
        );
    };
    ExpirationDate = "2024-09-03 11:36:47 +0000";
    IsXcodeManaged = 1;
    Name = "iOS Team Provisioning Profile: com.theone.theoneapp";
    Platform =     (
        iOS,
        xrOS,
        visionOS
    );
    ProvisionedDevices =     (
        "00008110-001A25983E43801E",
        "00008101-001E28D11AB9003A",
        "00008110-001C3D99263A401E",
        "00008030-001110C60A81802E",
        ffe04d5010536aab8371081b1323a94b32a1550a,
        "00008030-000270292668802E",
        "00008101-001E4DDE2652001E",
        "00008101-001A69E80EF1001E",
        da154c0ff38b9d07e48625be4e74f19d1e952eef,
        "00008101-00015D0A0EFA001E",
        "00008101-000869D214C2001E",
        "00008103-001D442A0A9A001E",
        "00006000-001251DC2238801E"
    );
    TeamIdentifier =     (
        MJZV368WRA
    );
    TeamName = "Smitten ehf.";
    TimeToLive = 365;
    UUID = "24cd1df2-3f4e-4d37-a01e-18aff1550820";
    Version = 1;
}
VERBOSE: getNotificationTypes:mSubscriptionStatus: -1
VERBOSE: HTTP Request (OneSignalUser.OSRequestCreateUser) with URL: https://api.onesignal.com/apps/3e6ee5a8-e283-4581-9f8d-f0830c633825/users, with parameters: {
  "identity" : {

  },
  "subscriptions" : [
    {
      "device_os" : "17.0.3",
      "enabled" : false,
      "net_type" : 0,
      "device_model" : "iPhone14,4",
      "test_type" : 1,
      "app_version" : "1.0.0",
      "type" : "iOSPush",
      "token" : "62c6cac0e5f7d57d2a4705adcc97ea5c3085973d73d449f5ac596ddb1698fbbd",
      "notification_types" : -18,
      "sdk" : "050002"
    }
  ],
  "properties" : {
    "timezone_id" : "Atlantic\/Reykjavik",
    "language" : "is-IS"
  }
}
VERBOSE: init redisplayedInAppMessages with: {
}
VERBOSE: startNewSession
VERBOSE: startNewSessionInternal
DEBUG: Outcomes cleared for current session
DEBUG: OneSignal SessionManager restartSessionIfNeeded with entryAction:: 2 channelTrackers: (
)
DEBUG: OneSignal SessionManager sendSessionEndingWithInfluences with influences: (
)
VERBOSE: getNotificationTypes:mSubscriptionStatus: -1
VERBOSE: OneSignalUserManagerImpl starting new session
VERBOSE: network response (OSRequestGetIosParams): {
    httpStatusCode = 200;
    outcomes =     {
        direct =         {
            enabled = 1;
        };
        indirect =         {
            enabled = 1;
            "notification_attribution" =             {
                limit = 10;
                "minutes_since_displayed" = 60;
            };
        };
        unattributed =         {
            enabled = 1;
        };
    };
    "receive_receipts_enable" = 1;
    "uses_provisional_auth" = 0;
}
VERBOSE: network response (OneSignalUser.OSRequestCreateUser): {
    errors =     (
                {
            title = "The provided language value is not a supported ISO 639-1 value";
        }
    );
    httpStatusCode = 400;
}
ERROR: OSUserExecutor create user request failed with error: Optional(Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={
    errors =     (
                {
            title = "The provided language value is not a supported ISO 639-1 value";
        }
    );
    httpStatusCode = 400;
}})
DEBUG: OSOperationRepo not flushing queue due to being paused
DEBUG: OSOperationRepo not flushing queue due to being paused
VERBOSE: OneSignal.User login called with externalId: fake_external_user_id_7
VERBOSE: OneSignalUserManager internal _login called with externalId: fake_external_user_id_7
VERBOSE: OneSignalUserManagerImpl prepareForNewUser called
DEBUG: OSOperationRepo not flushing queue due to being paused
VERBOSE: HTTP Request (OneSignalUser.OSRequestCreateUser) with URL: https://api.onesignal.com/apps/3e6ee5a8-e283-4581-9f8d-f0830c633825/users, with parameters: {
  "identity" : {

  },
  "subscriptions" : [
    {
      "test_type" : 1,
      "device_os" : "17.0.3",
      "type" : "iOSPush",
      "enabled" : false,
      "device_model" : "iPhone14,4",
      "token" : "62c6cac0e5f7d57d2a4705adcc97ea5c3085973d73d449f5ac596ddb1698fbbd",
      "net_type" : 0,
      "notification_types" : -18,
      "app_version" : "1.0.0",
      "sdk" : "050002"
    }
  ],
  "properties" : {
    "timezone_id" : "Atlantic\/Reykjavik",
    "language" : "is-IS"
  }
}
VERBOSE: network response (OneSignalUser.OSRequestCreateUser): {
    errors =     (
                {
            title = "The provided language value is not a supported ISO 639-1 value";
        }
    );
    httpStatusCode = 400;
}
ERROR: OSUserExecutor create user request failed with error: Optional(Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={
    errors =     (
                {
            title = "The provided language value is not a supported ISO 639-1 value";
        }
    );
    httpStatusCode = 400;
}})
DEBUG: OSOperationRepo not flushing queue due to being paused
DEBUG: OSOperationRepo not flushing queue due to being paused
VERBOSE: OneSignal.User login called with externalId: fake_external_user_id_7
VERBOSE: OneSignalUserManager internal _login called with externalId: fake_external_user_id_7
VERBOSE: OneSignalUserManager.createNewUser: not creating new user due to logging into the same user.)
DEBUG: OSOperationRepo not flushing queue due to being paused
DEBUG: OSOperationRepo not flushing queue due to being paused

Code of Conduct

  • I agree to follow this project's Code of Conduct
@magtastic
Copy link
Author

Original issue; OneSignal/react-native-onesignal#1568

@emawby
Copy link
Contributor

emawby commented Oct 31, 2023

Thank you for reporting we are investigating

@emawby emawby added the Bug label Oct 31, 2023
@nan-li
Copy link
Contributor

nan-li commented Nov 2, 2023

Hi @magtastic I have followed up on the original issue, where it will be tracked, so I will close this one as a duplicate.

@nan-li nan-li closed this as completed Nov 2, 2023
@magtastic
Copy link
Author

@nan-li @emawby

Thanks for the quick resolution!

@Romick2005
Copy link

Romick2005 commented Dec 18, 2023

Same here. In my case backend was sending valid ISO-639-1 value se as language code to https://api.onesignal.com/apps/<APP_ID>/users api, but got "The provided language value is not a supported ISO 639-1 value":

  "statusCode": 400,
  "body": {
    "errors": [
      {
        "title": "The provided language value is not a supported ISO 639-1 value"
      }
    ]
  },

image

Would be great if all languages code from valid ISO-639-1 list were supported. Otherwise please provide the list of onesignal supported languages.
User screenshot:
image

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