Bug 273063 - iOS service worker - webPush subscription becomes invalid for few users
Summary: iOS service worker - webPush subscription becomes invalid for few users
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: Safari 17
Hardware: iPhone / iPad iOS 17
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-04-22 04:30 PDT by Thawfeeq
Modified: 2024-07-30 02:11 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thawfeeq 2024-04-22 04:30:29 PDT
It seems that PWA push notifications on iOS are sometimes being revoked outside of user interaction. In the event handler, when we check the service worker registration for an active push subscription via ServiceWorkerRegistration.pushmanager.getSubscription(), and sometimes it reports null, indicating that the push subscription which was just used to receive a message is now no longer active. We had seen 1 such case recently. We would like to know how & when this happens.

This is a fail for PWA push notifications on iOS, especially given that the pushsubscriptionchange event is not supported. Reference: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/pushsubscriptionchange_event . Could you please take a look?
Comment 1 Ahmad Saleem 2024-04-22 07:08:12 PDT
@Thawfeeq - do you have minimal test case or you have any theory on why you think this is happening e.g., Intelligent Tracking Protection? Also which version of iOS, you are referring (iOS 17.4.1)?

Appreciate if you can share more details and context.

I have only found this one more thread but also without more context - https://developer.apple.com/forums/thread/727372
Comment 2 Thawfeeq 2024-04-22 22:09:55 PDT
iOS VERSION - 17.4.1
Browser- Safari

We haven't identified an exact reproducible scenario - as this has been reported by only a few users.
Comment 3 Thawfeeq 2024-04-23 01:24:47 PDT
We are currently trying to identify the patterns which can lead to this behaviour.. I see such issues reported in apple forums - but no solid solution yet. 

Also I see that PushSubscriptionChange event ( https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/pushsubscriptionchange_event ) , which is used for handling such scenarios , is not supported for mobile devices at all.
Comment 4 Radar WebKit Bug Importer 2024-04-29 04:31:14 PDT
<rdar://problem/127225883>
Comment 5 Ben Nham 2024-05-09 16:28:04 PDT
We don't fire PushSubscriptionChangeEvent, and the last time I checked (which was admittedly several years ago), no other browsers did either. The IDL is in the repo but is otherwise unused.

I'm not sure we can do much without a sysdiagnose (which you can include via a Feedback Assistant report). We did fix a number of bugs with Web Push on iOS recently (which should be in 17.5 RC), but the bugs weren't in WebKit but rather in Web.app, e.g. bugs where Web.app would handle the push, but then tell WebKit that the website didn't have permissions anymore, which would then result in the subscription being deleted. 

Can you try reproing on 17.5 RC and/or filing a Feedback Assistant report with a sysdiagnose?
Comment 6 Berni 2024-07-30 02:11:44 PDT
After updating to 17.6 I had to resubscribe again, otherwise Notifications where not delivered. Unfortunately no further information yet.