OneSignal / OneSignal-Cordova-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Ionic, PhoneGap CLI, PhoneGap Build, Cordova, or Sencha Touch app with OneSignal. Supports Android, iOS, and Amazon's Fire OS platforms. https://onesignal.com
Other
250 stars 197 forks source link

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

Closed v12cicd closed 1 month ago

v12cicd commented 9 months ago

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?

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

TobiTobsn007 commented 7 months ago

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

TobiTobsn007 commented 7 months ago

@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!

EinfachHans commented 5 months ago

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.

mariusbolik commented 3 months ago

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!

leemind commented 1 month ago

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);
});
}
nan-li commented 1 month ago

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.