Subscription permission denied on webapp push

HI, please can someone help?

I have a web app where push notifications are in place for Chrome, Firefox, and Edge. Providing the user allows notifications then when they log in for the first time their details are registered to the subscriptions table in the backend. All good so far.

When trying to do the same with Safari on Mac I'm faced with this issue:

"Safari doesn’t support invisible push notifications. Present push notifications to the user immediately after your service worker receives them. If you don’t, Safari revokes the push notification permission for your site."

and the user is not registered in the subscription table with the Safari console just saying variations of this:

[Warning] Notification permission denied. (notifications_frontend.js, line 177, x2) [Log] Enable Notifications button clicked (notifications_frontend.js, line 245) [Log] Safari Push Notifications detected (notifications_frontend.js, line 248) [Warning] Safari Push Permission denied. (notifications_frontend.js, line 278)

I've found this on an another forrum:

"Safari requires that you immediately post a notification when a push message is received. "Immediately" means that it cannot be after some async operation.

If you display a notification immediately from the service worker itself, it will stop displaying that error. I cannot remember 100% but I think if you clear your cache and cookies you will be able to receive push messages again if you accidentally get blocked while testing."

and I've tried adding buttons to trigger allowing notifications but it all seem to late to get the subscription registered in the subscription table.

I'm pretty new to coding so if any has a similar experience and can advice how to get the subscriptions registered when the user logs on for the first time in Safari in a Mac it would be greatly appreciated.

Thanks...

Subscription permission denied on webapp push
 
 
Q