Bug 261767

Summary: REGRESSION (iOS 17): PWA startup "FetchEvent.respondWith received an error TypeError: Internal error"
Product: WebKit Reporter: Jesper Bendtsen <jesperbendtsen83>
Component: Service WorkersAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Critical CC: achristensen, annevk, beidson, cdumez, kyro38, michael.hagar, niels, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 17   
Hardware: iPhone / iPad   
OS: Other   
Attachments:
Description Flags
Screenshot none

Description Jesper Bendtsen 2023-09-19 13:10:38 PDT
Created attachment 467765 [details]
Screenshot

After update to iOS 17, PWA fails at startup.

Video, screenshot, diagnose log and access to test env are added to this feedback:

https://feedbackassistant.apple.com/feedback/13188943

Please help, it is very bad for my organization...
Comment 1 Radar WebKit Bug Importer 2023-09-19 14:44:09 PDT
<rdar://problem/115747046>
Comment 2 Alexey Proskuryakov 2023-09-19 14:44:21 PDT
rdar://115740959
Comment 3 Jesper Bendtsen 2023-09-20 22:03:48 PDT
The error happens on both iPad iOS 17 and iPhone iOS 17
Comment 4 Jesper Bendtsen 2023-09-25 11:45:39 PDT
Angular 
https://github.com/angular/angular/issues/50378
Comment 5 Matthieu Riegler 2023-09-25 11:49:00 PDT
OSS Angular contributor here, I can provide some insights. 

The error has been reported first on the framework repo : https://github.com/angular/angular/issues/50378 

The issue can be narrowed down to a call `caches.match` that throws a "TypeError: Internal error"

The error OP is reporting is because that error wasn't catched and `FetchEvent.respondWith` failed. 

I believe the root cause is still on Safari's side with the internal error being thrown by the method call mentioned above. 

Related workaround PR on Angular's side : https://github.com/angular/angular/pull/51885/files
Comment 6 youenn fablet 2023-09-26 03:08:51 PDT
Pull request: https://github.com/WebKit/WebKit/pull/18217
Comment 7 youenn fablet 2023-09-26 09:30:48 PDT
There are several potential issues that can lead to the Internal error case.
One of the main issues can probably be worked around by calling self.caches.open() (and then match) instead of doing self.caches.match().
Comment 9 Michael Hagar 2023-09-27 05:58:00 PDT
I'm seeing a similar error on Desktop Safari 17 for our PWA that is using a service worker to cache JS assets. The fetch fails with "Failed to load resource: FetchEvent.respondWith received an error: no-response: no-response :: [{"url":"<url>", "error":{}}]
Comment 10 EWS 2023-09-27 23:52:29 PDT
Committed 268565@main (dd68eb88a64c): <https://commits.webkit.org/268565@main>

Reviewed commits have been landed. Closing PR #18217 and removing active labels.