尝试加载时服务工人获取错误---我的网站? [英] Service Worker Fetch Error When Trying to Load --- My Website?

查看:87
本文介绍了尝试加载时服务工人获取错误---我的网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将Cloudfront添加到了我的Web应用程序中.我正在使用WorkBox服务工作者并收到错误消息:

VM7 workbox-strategies.prod.js:1未捕获(已承诺)TypeError:无法获取

我从

将域加载到浏览器中就可以了.服务人员为什么会抛出此提取错误?

解决方案

您看到的是由于

(Chrome DevTools小组意识到这可能会造成一些混乱,并且正在努力改善向开发人员报告的方式.)

I've recently added Cloudfront to my web app. I'm using a WorkBox service worker and getting the error:

VM7 workbox-strategies.prod.js:1 Uncaught (in promise) TypeError: Failed to fetch

I found out from this SO post to watch the Network tab to find out what resource was causing the problem.

I checked and found out -- it's trying to load my own domain!

The domain loads in the browser just fine. Why would the service worker be throwing this fetch error?

解决方案

What you're seeing is due to the new offline support detection in Chrome 89+.

If your site has a web app manifest and a service worker, Chrome will automatically simulate an offline connection and then make a request for the start_url listed in your web app manifest.

If your service worker uses a network-first strategy for responding to navigation requests, then there may be a failed network request logged in the Network panel, even if the check ultimately succeeds because of a response from the cache.

(The Chrome DevTools team is aware that this can be a bit confusing, and is working on improving how this is reported to developers.)

这篇关于尝试加载时服务工人获取错误---我的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆