OneSignal-Cordova-SDK icon indicating copy to clipboard operation
OneSignal-Cordova-SDK copied to clipboard

FATAL: OneSignal AppId: (null) - AppId is null or format is invalid, stopping

Open v12cicd opened this issue 1 year ago • 4 comments

What happened?

app stuck juste after the lunch screen

Steps to reproduce?

I followed exactly the steps described at the wiki page https://documentation.onesignal.com/docs/cordova-sdk-setup

What did you expect to happen?

at the minimum the app works

OneSignal Cordova SDK version

5.0.4

Which platform(s) are affected?

  • [X] iOS
  • [ ] Android

Relevant log output

2023-12-06 19:35:41.522750+0100 gpsfleet[14810:3659793] Apache Cordova iOS platform version 7.0.1 is starting.
2023-12-06 19:35:41.531322+0100 gpsfleet[14810:3659793] FATAL: OneSignal AppId: (null) - AppId is null or format is invalid, stopping initialization.

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

v12cicd avatar Dec 06 '23 18:12 v12cicd

I'm using v5.0.5 and have the same problem. Is there any update regarding this issue?

TobiTobsn007 avatar Feb 02 '24 08:02 TobiTobsn007

@v12cicd I solved my problem. It seems, that the error message FATAL: OneSignal AppId: (null) - AppId is null or format is invalid, stopping initialization. has no negative effects. My problem was the buildOptimizer when building on prod configuration. Setting it to false in angular.json solved the problem.

After changing OneSignal.Debug.setLogLevel(LogLevel.Verbose); to OneSignal.Debug.setLogLevel(6); I could activate the buildOptimizer and everything works fine. Try it and let me know!

TobiTobsn007 avatar Feb 02 '24 20:02 TobiTobsn007

Happens for me in Capacitor with 5.1.0 as well. As mentioned here, a small timeout seems to fix it.

Anyways it has negative effects, because the subscription id is null in the sdk if this happens.

EinfachHans avatar Mar 27 '24 19:03 EinfachHans

On Ionic / Angular you can add the following line before the OneSignal Plugin Initialization:

await this.platform.ready();

This also seems to fix the error!

mariusbolik avatar May 24 '24 15:05 mariusbolik

For anyone coming to this thread who uses Meteor (Cordova under the hood) I found this worked:

// Accounts.onLogin()
if (Meteor.isCordova) {
    console.log("isCordova - setting up push notifications");
    // This only runs when the device is ready - jQuery .ready() function shorthand (recommended)
    $(setupNotifications)
  }

function setupNotifications() {
  console.log("In setupNotifications")
  OneSignal.Debug.setLogLevel(6)
  OneSignal.initialize(oneSignalAppID)
  
  console.log("Logging into OneSignal with userID",Meteor.userId())
  OneSignal.login(Meteor.userId())

  OneSignal.Notifications.requestPermission(true).then((accepted) => {
    console.log("User accepted notifications: ",accepted);
});
}

leemind avatar Jul 27 '24 11:07 leemind

Hi everyone, since you are using one of our cross-platform SDKs, this is a misleading error message that prints from the integration of our cross platform SDK with our native iOS SDK.

Please check your logs to see if the following prints after the FATAL log, that the App ID is successfully set, so you can safely ignore the error log.

VERBOSE: setAppId called with appId: abcd-1234-abcd-1234
VERBOSE: launchOptions is set and appId of abcd-1234-abcd-1234 is set, initializing OneSignal...

This is an alarming error log and misleading, we will work on suppressing or rewording the log.

If you are seeing other issues or side-effects, please open a new issue with your description.

nan-li avatar Aug 06 '24 15:08 nan-li