GoogleChrome / GoogleChrome/workbox

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

Open
#3,343 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
13k
Forks
880
Avg merge
2h 44m
Merged PRs (30d)
8

Description

**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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.