Next.js Discord

Discord Forum

push service error - webpush + Nextjs + serwist

Unanswered
Shiny Cowbird posted this in #help-forum
Open in Discord
Shiny CowbirdOP
Was following this https://nextjs.org/docs/app/guides/progressive-web-apps#2-implementing-web-push-notifications and getting this error, dont really nderstand why, here are my files

/src/app/actions.js
https://sourceb.in/uQvjNlRe4l
/src/app/sw.js
https://sourceb.in/4Nnoh1SNRm
/src/app/pushNotificationManager.js
https://sourceb.in/fXazb1lhIu
next.config.mjs
https://sourceb.in/r966WCTsNe

getting confirmation serwist worker is working yes

generated the web push keys through web-push generate-vapid-keys
everything else seems to be alright just the error in
 const sub = await registration.pushManager.subscribe({
            userVisibleOnly: true,
            applicationServerKey: key
        })

2 Replies

Shiny CowbirdOP
on browsers except chrome I dont have this error and it passes fine but at the end I get no notificaiton ( Both firefox and Microsoft Edge )

{
  endpoint: 'https://wns2-pn1p.notify.windows.com/w/?token=BQYAAAA0EuA%2bntumS3vq%2bdK15R6ZI5RjTRNNKsRT3DClYaUnut%2f2%2f9hFmH%2bR2%2fMCiai8mx7X7Ni0Yxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx9d4iRbGSj22I5iLxzb1YVz',
  expirationTime: null,
  keys: {
    p256dh: 'BNAZKfxxxxxxxxxxxxxxxxxxxxxxvDWCugA4Z9gHwUJ9m-Y6WacK7CQO8CyXsuF_xOI6IjHWBhZHW_Q',
    auth: '2H1txxxxxx9_p1eQ'
  }
}
this is what I get in those, no notification tho