Closed cgar420 closed 7 months ago
@cgar420 Thanks for reporting!
On the OneSignal dashboard, under Settings > Platforms > Web do you have "Typical Site" or "Custom Code"?
If the above doesn't help can you enable VERBOSE logging and share the log here? Also check the network tab to see if it's making a network call to POST onesignal.com/.../notifications
.
Lastly include the browsers you have tested.
@jkasten2 I'm using custom code, not typical site
Im getting this error in the console
The FetchEvent for "https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js" resulted in a network error response: the promise was rejected.
@cgar420 that file contains the main part of the OneSignal SDK that runs on the page. If that doesn't load nothing will work with OneSignal, won't be prompted, won't make any calls to create the User, etc.
If you are using an ad-blocker make sure to disable it, or use a browser profile without it.
@cgar420 were you able to solve this issue with the details in my last reply?
No unfortunately it's still not working.
I get all of the prompts, but don't actually receive any notifications.
In chrome network tab I can see that it fetches a couple things from onesignal. And no errors in the console.
https://webwizard.biz https://GitHub.com/cgar420/WebWizard_v2 has all the site files.
The onesignal sdk is in the /public folder with default service worker path settings. It shows the service worker as active
Then I have a component that initializes onesignal in a use effect
On Tue, Apr 16, 2024, 10:51 AM Josh Kasten @.***> wrote:
@cgar420 https://github.com/cgar420 were you able to solve this issue with the details in my last reply?
— Reply to this email directly, view it on GitHub https://github.com/OneSignal/OneSignal-Website-SDK/issues/1168#issuecomment-2059642466, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUJPGJB7ZSY4RKAR6MYUGYTY5VQLBAVCNFSM6AAAAABGFYFSPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJZGY2DENBWGY . You are receiving this because you were mentioned.Message ID: @.***>
@cgar420 thanks for sharing your site. I took a look and I see you have another service worker sw.js
and it is overwriting the OneSignal service worker. When this happens the OneSignal SDK can no longer process push.
You can add a scope to OneSignal to avoid this issue (set "Service worker registration scope" to something like /onesignal/
). See this documentation page on doing so:
https://documentation.onesignal.com/docs/onesignal-service-worker-faq
I got it working now! Thank you so so much!
On Tue, Apr 16, 2024, 12:47 PM Josh Kasten @.***> wrote:
@cgar420 https://github.com/cgar420 thanks for sharing your site. I took a look and I see you have another service worker sw.js and it is overwriting the OneSignal service worker. When this happens the OneSignal SDK can no longer process push.
You can add a scope to OneSignal to avoid this issue. See this documentation page on doing so: https://documentation.onesignal.com/docs/onesignal-service-worker-faq
— Reply to this email directly, view it on GitHub https://github.com/OneSignal/OneSignal-Website-SDK/issues/1168#issuecomment-2059811611, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUJPGJB3MHG7H5KR572RB6LY5V54JAVCNFSM6AAAAABGFYFSPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJZHAYTCNRRGE . You are receiving this because you were mentioned.Message ID: @.***>
Good to hear! I'll close this issue as resolved then.
how to check if service worker is over written or not?
How can we help?
Here is my component to render OneSignal UI in the app. It works. I can see the slide prompt and subscription bell, and subscribe to push notifications. And I can receive notifications when they are sent from the onesignal dashboard
BUT the welcomeNotification does not trigger. Am I doing something wrong?
This is in Next.js 14 app router. I use
<OneSignalUI/>
defined below in my Root Layout