2

I am getting below console error :- Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'ServiceWorkerGlobalScope': 'only-if-cached' can be set only with 'same-origin' mode

I am using below code for cache all request which consist xy/xyAPI/api :-

workbox.routing.registerRoute(
  new RegExp('xy/xyAPI/api'),
  workbox.strategies.networkFirst({
    cacheName: 'api-url',
    plugins: [
      new workbox.expiration.Plugin({
        maxEntries: 20,
        maxAgeSeconds: 24 * 60 * 60
      }),
      new workbox.broadcastUpdate.Plugin('api-url', {
        headersToCheck: ['date'],
      })
    ]
  }));

1 Answer 1

1

Looks like this is chromium bug. You can check the logged issue details here https://bugs.chromium.org/p/chromium/issues/detail?id=823392

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.