OneSignal/onesignal-vue3

[Bug]: not working in vue3 + vite

Closed this issue · 7 comments

What happened?

OneSignal: This app ID does not match any existing app. Double check your app ID.

Steps to reproduce?

npm i @onesignal/onesignal-vue3

//main.js
createApp({ render: () => h(App, props) })
            .use(plugin)
            .use(OneSignalVuePlugin)
            .use(Quasar, quasarUserOptions)
            .directive("dragscroll", dragscrollNext)
            .mount(el);

//component
const useOnesignal = useOneSignal()
await useOnesignal.init({ appId: 'xxxxxxxxxxxxxxxxxxxxxxx' })

What did you expect to happen?

That worked normally

Relevant log output

window.OneSignal already defined as 'object'!
         Please make sure to define as 'window.OneSignal = window.OneSignal || [];' OneSignalStubES6 {VERSION: 151514, log: {…}, directFunctionCallsArray: Array(0), preExistingArray: Array(4), on: ƒ, …}
e.addOneSignalPageES6SDKStub @ OneSignalShimLoader.js:41
e.start @ OneSignalShimLoader.js:66
(anônimo) @ sdk.js:13
n @ bootstrap:19
(anônimo) @ bootstrap:68
(anônimo) @ bootstrap:68
VM2043 OneSignalPageSDKES6.js:1 
        
       Uncaught (in promise) f: OneSignal: The OneSignal web SDK can only be initialized once. Extra initializations are ignored. Please remove calls initializing the SDK more than once.
    at nt.errorIfInitAlreadyCalled (https://cdn.onesignal.com/sdks/OneSignalPageSDKES6.js?v=151514:1:150417)
    at Bi.<anonymous> (https://cdn.onesignal.com/sdks/OneSignalPageSDKES6.js?v=151514:1:273793)
    at Generator.next (<anonymous>)
    at r (https://cdn.onesignal.com/sdks/OneSignalPageSDKES6.js?v=151514:1:716)
errorIfInitAlreadyCalled @ VM2043 OneSignalPageSDKES6.js:1
(anônimo) @ VM2043 OneSignalPageSDKES6.js:1
r @ VM2043 OneSignalPageSDKES6.js:1
Promise.then (assíncrono)
c @ VM2043 OneSignalPageSDKES6.js:1
(anônimo) @ VM2043 OneSignalPageSDKES6.js:1
n @ VM2043 OneSignalPageSDKES6.js:1
init @ VM2043 OneSignalPageSDKES6.js:1
(anônimo) @ index.ts:152
processItem @ VM2043 OneSignalPageSDKES6.js:1
push @ VM2043 OneSignalPageSDKES6.js:1
processAsArray @ VM2043 OneSignalPageSDKES6.js:1
processAsES6Stub @ VM2043 OneSignalPageSDKES6.js:1
doReplay @ VM2043 OneSignalPageSDKES6.js:1
(anônimo) @ VM2043 OneSignalPageSDKES6.js:1
(anônimo) @ VM2043 OneSignalPageSDKES6.js:1
i @ VM2043 OneSignalPageSDKES6.js:1
(anônimo) @ VM2043 OneSignalPageSDKES6.js:1
(anônimo) @ VM2043 OneSignalPageSDKES6.js:1
VM2043 OneSignalPageSDKES6.js:1 
        
       Uncaught (in promise) f: OneSignal: This app ID does not match any existing app. Double check your app ID.
    at Pi.<anonymous> (https://cdn.onesignal.com/sdks/OneSignalPageSDKES6.js?v=151514:1:242326)
    at Generator.next (<anonymous>)
    at https://cdn.onesignal.com/sdks/OneSignalPageSDKES6.js?v=151514:1:883
    at new Promise (<anonymous>)
    at n (https://cdn.onesignal.com/sdks/OneSignalPageSDKES6.js?v=151514:1:660)
    at Pi.getAppConfig (https://cdn.onesignal.com/sdks/OneSignalPageSDKES6.js?v=151514:1:242241)
    at Ci.<anonymous> (https://cdn.onesignal.com/sdks/OneSignalPageSDKES6.js?v=151514:1:254410)
    at Generator.next (<anonymous>)
    at https://cdn.onesignal.com/sdks/OneSignalPageSDKES6.js?v=151514:1:883
    at new Promise (<anonymous>)

"vite": "^2.9.11"
"vue": "^3.2.33",

Howdy,
Thanks for your patience.

Can you double check that your app Id is correct by comparing it to the value on your OneSignal dashboard?

Closing due to no response.

Can you double check that your app Id is correct by comparing it to the value on your OneSignal dashboard?

I also got the same error and I checked and made sure my appId is correct

Any update about this? Same problem here.
In dev mode its ready. But, in production mode have a error
image

image

This error only happen if i add this line
image
If I comment this line, it's works

Any update about this? Same problem here. In dev mode its ready. But, in production mode have a error image

image

This error only happen if i add this line image If I comment this line, it's works

I updated to 2.0.0-beta.5 and its works for me

Glad to hear it is working on the new beta. Just please make sure to follow the migration guide!