Closed fescherer closed 7 months ago
You can find instructions on the service worker at https://pusher.com/docs/beams/getting-started/web/sdk-integration/#create-a-service-worker.
The error message looks like the code has been minified, which makes following the stack trace impossible. Are you able to run a build without this and share the error?
What device/browser are you using for this test?
You can find instructions on the service worker at https://pusher.com/docs/beams/getting-started/web/sdk-integration/#create-a-service-worker.
The error message looks like the code has been minified, which makes following the stack trace impossible. Are you able to run a build without this and share the error?
What device/browser are you using for this test?
Hello, sorry for the late reply, I was testing some stuff and probably my service worker was wrong, but even now that I think I made everthing fine, it still doesn't work :/
About the error, yes, probably is because minification. I never made a pwa app so I just followed the instructions using https://www.npmjs.com/package/next-pwa, but essentially I made a folder worker
with index,js
and inside importScripts('https://js.pusher.com/beams/service-worker.js')
just like https://github.com/shadowwalker/next-pwa/tree/master/examples/web-push but using the worker for pusher.
Now, my nextjs.config is this:
And the when running build, it creates three files sw,js
and the two workbox.
So the pusher script is called sw.js
insted service-worker.js
as your doc link says... Could be it the issue I am having?
I could make the build with name service-worker.js
by adding this to next config:
But still does not work :/
I found that next-pwa does not support app router from Next 13. And because of this, the service worker is acting weird. I am gonna close this issue because it is not related to Pusher
Hello. I am recently creating a PWA application to send notifications with pusher. For some reason in the localhost the notifications works, but when I deployed to vercel and teste on browser and PWA installed version, none of them works. I searched a lot and could not find a proper tutorial or some docs that could help me.
The error is this from the image below:![image](https://github.com/pusher/push-notifications-web/assets/62115215/3f38c3a0-64ce-4d98-acc8-a20f02354090)
As it says could not find the function, because of this, I think the script from pusher is not been loaded. This is my next config:![image](https://github.com/pusher/push-notifications-web/assets/62115215/6b071c90-6e63-4fd9-aa83-25832b9ba3e9)
Also, what is the minimum code for my service worker?