OneSignal/onesignal-vue3

[Bug]: Running against localhost with our app-id

Opened this issue · 5 comments

How can we help?

The vue plugin we are using is combined with a vitesse app (I don't believe this impacts anything)

  • I've tried running it in an incognito as well, but unsuccessfully
  • Also tried creating a fresh app through the admin app, but still having the same issue.
  • The weird thing is that (the same organisation different app) still works on our remotely build app, so my guess would be it's the localhost setting?

But now trying to create a new app it seems to not work on localhost.
Below is the config.

Screenshot 2023-08-18 at 13 58 38

This is the error I get, I haven't found anything, so not sure it's a bug or a question in this case

Here is the error I got, when trying to understand it (it seems to be in the library itself?), but I don't have a reason for it.
Screenshot 2023-08-18 at 13 59 20

Here is the code I got too while trying to debug:
Screenshot 2023-08-18 at 14 00 47

@BramDecuypere I am not able to reproduce this issue.

My attempt at reproducing issue

1. Created new Vue3 project

npm create vue@3.7.3 vue3-OneSignal-test
Add TypeScript?  Yes
Add JSX Support? No
Add Vue Router for Single Page Application development? / Yes
Add Pinia for state management?  No
 Add Vitest for Unit Testing?  Yes
Add an End-to-End Testing Solution? › No
Add ESLint for code quality? Yes
Add Prettier for code formatting? Yes

cd vue3-OneSignal-test
npm install
npm run format
npm run dev

2. Install OneSignal

npm install --save @onesignal/onesignal-vue3

3. Add OneSignal code

Added OneSignal to src/main.ts. Full code for this file:

import './assets/main.css'

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'

import OneSignalVuePlugin from '@onesignal/onesignal-vue3'

const app = createApp(App)

// Initialize OneSignal
app.use(
  OneSignalVuePlugin,
  {
    appId: 'df886d95-7bd2-48b0-9d3a-abb24d2746ac',
  }
);

app.use(router)
app.mount('#app')

Question

Can you share how and where you are initializing OneSignal?

  • Please provide steps like about to reproduce if possible.

@jkasten2 thanks for the help!

Followed your exact setup. (Initially thought it might be our setup) But it seems it's really with our app-id/account related.
Since I believe the app-id isn't sensitive info, could it be that it has to do something with our account? We did remove an app and added something similar. Not sure of course how that might work.

If the app-id IS sensitive, please do let me know so I can remove it

34f47e70-1c71-478a-bcbb-7272014874a4

Screenshot 2023-08-21 at 15 15 15

Screenshot 2023-08-21 at 15 19 48

PS: Editing my code to the app-id you used in your setup - df886d95-7bd2-48b0-9d3a-abb24d2746ac makes me get the last image.

Screenshot 2023-08-21 at 15 38 33

[UPDATE] - it randomly started working, still has the issue on some loads.

The "TypeError: Cannot read properties of undefined (reading 'message')" is due to your app being configured as HTTP instead of HTTPS. The v2 of this plugin only supports HTTPS, see this comment for more details.

@jkasten2 but shouldn't that be solved with the option of "local testing - treat http as HTTPS"?