Safari 17.4> Web push Api Broken?

Hi,

We are having issues trying to get the Web Push API working in Safari 17.4/5 and 18 beta (both on ios and macos).

Below you can find a basic vanilla web app that tests push subscription (its not wired up to actual service but does allow testing the client side).

It has been configured as per the push api requirements..

  • Runs over https (using self signed certificate).
  • Runs a service worker.
  • Asks for permissions via button click before subscribing.

Running this on macos chrome/firefox works fine, after providing permissions the promise returns a populated subscription object (Endpoint / p256dh values etc). When reloading the site, the subscription is persisted.

In Safari, the permissions are requested as per other browsers but the returned subscription promise object (see code below) (https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription), although the keys are present, contains all empty values. Calling GetKeys for any of the values, also returns empty. On reload, it is clear that a subscription was not actually created.

  serviceWorkerRegistration.pushManager.subscribe(subscribeOptions).then(function (subscription) {
                return subscription;
            }).catch(function (error) {
                console.log('Error:', error);
                throw error;
            });

The subscription promise does not catch, so why these values are empty is a mistry. The same code works fine on other browsers on the same OS, so it seems there is an underlying issue in safari's implementation of the web push api.

Can you please run the sample app and confirm if you see the same issue, together with any required changes if it's a coding issue, or, confirm that this is a safari bug? If its a limitation due to config etc, then the catch should be thrown with a useful error.

Github repo.. https://github.com/andyball89/web-push-testing

Thanks, Andy

Safari 17.4> Web push Api Broken?
 
 
Q