workbox icon indicating copy to clipboard operation
workbox copied to clipboard

FetchEvent.respondWith received an error - for Google Tag Manager (GTM) script

Open mtwalsh opened this issue 6 months ago • 0 comments

Library Affected:

  • workbox-webpack-plugin using GenerateSW plugin v7.1.0

Browser & Platform:

  • Safari 17.5 macOS (I believe there's the same issue on Safari on iOS as well)

Issue Description:

In Safari 17.5 on macOS on the second page-load (once the Service Worker (SW) is activated) I notice the following errors in the console, this is with Google Tag Manager installed in the page as per the normal instructions:

[Error] FetchEvent.respondWith received an error: no-response: The strategy could not generate a response for 'https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXX'.
[Error] Cannot load https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXX.
[Error] Failed to load resource: FetchEvent.respondWith received an error: no-response: The strategy could not generate a response for 'https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXX'. (gtm.js, line 0)

This is preventing Google Tag Manager (GTM) from working after the SW is activated.

I don't have any runtimeCaching entries specifically for this URL so the SW shouldn't be doing anything out of the ordinary for the GTM script.

I do have offlineGoogleAnalytics: true enabled (if that could be relevant) but disabling that makes no difference.

mtwalsh avatar Aug 08 '24 09:08 mtwalsh