Fetchevent respondwith received an error returned response is null что за ошибка
Safari bug #1730
Comments
dijonkitchen commented Oct 23, 2018 •
Library Affected:
workbox-sw, workbox-build, etc.?
Browser & Platform:
Safari 12
macOS High Sierra 10.13.6
Issue or Feature Request Description:
Refreshing workbox PWAs (like https://material-ui.com) leads to this sometimes.
Confirmed that they work fine on Firefox, Chrome and private mode Safari.
I figured if I cleared the cache, it would help, but it doesn’t seem to kill the service workers.
Workaround is to disable service workers in Developer mode and I can load the websites properly.
The text was updated successfully, but these errors were encountered:
jeffposnick commented Oct 23, 2018
I just testing things out on Safari 12 on the desktop, and was not able to reproduce after navigating around to a few pages controlled by the service worker on https://material-ui.com. So, if there are any concrete reproduction steps that you’ve been able to narrow down, I’d love to dig in deeper.
In the meantime, though, I’ve noticed that you’re using a v3.0.0 pre-release version of Workbox. Workbox is up to v3.6.3 now (and we’ve got v4 alphas out), so as a first step, could you try upgrading your copy of Workbox? There were a number of improvements made throughout the v3 releases, and I’d like to at least make sure that we’re starting from the latest codebase.
dijonkitchen commented Oct 24, 2018
Thanks @jeffposnick, I don’t control the site, so I’ll cross-post there.
dijonkitchen commented Oct 24, 2018
@jeffposnick did you also trying refreshing pages? This should be when the Service workers do their work using the cache instead of routing through the single-page app.
jeffposnick commented Oct 24, 2018
Yes, I’ve tried a few times now to go through full navigations as well as page reloads and trigger any failures in Safari 12. I’ve not had any luck.
(That’s not to say that there isn’t an issue; it’s just that odd bugs can crop up in browsers’ implementations of service workers that are hard to trigger.)
NekR commented Oct 24, 2018 •
This is iOS 12 Safari bug.
(It isn’t fixed in 12.0.1)
jeffposnick commented Oct 24, 2018
As per the initial issue report, I was working under the assumption that this was being seen on the desktop (Safari 12 / macOS High Sierra 10.13.6).
NekR commented Oct 24, 2018
@jeffposnick hmm.. yeah, indeed. Then it must be the same bug on macOS as well because the error line is the same as on iOS when this happens.
dijonkitchen commented Oct 24, 2018
Yes, my error was on macOS Safari. For what it’s worth, I tried it out on another laptop that recently upgraded to macOS Mojave and Safari there was fine.
oliviertassinari commented Oct 24, 2018
We gonna start by upgrading the version of workbox on material-ui side.
oliviertassinari commented Nov 6, 2018 •
We have been upgrading the version of workbox from the beta to the latest version. It hasn’t gone smoothly, a lot of people were facing cache invalidation issues. This is something that happens quite often every time we release a new version. It takes time to propagate. The cache invalidation is an important limitation of the service workers.
I’m suspecting it’s because of the next service worker waiting for its activation. Maybe there is a way to force it? At the expense of an unexpected full page reload when the user tries to refresh the page or to navigate to a different page. I will explore this path: https://developers.google.com/web/tools/workbox/guides/advanced-recipes.
dijs commented Nov 14, 2018
Our team recently found this issue as well. Is the solution to upgrade workbox?
jeffposnick commented Nov 19, 2018
Our team recently found this issue as well. Is the solution to upgrade workbox?
The material-ui site was using a very outdated Workbox v3 beta, so updating was a good idea in general.
More recent versions of Workbox have had better «cache miss» fallback logic to take into account the fact that items that should be precached aren’t necessarily going to be there (due to browser bugs, or other failure scenarios), so they are more robust about at least showing something from the network when this crops up, instead of just failing to load the cached response.
But in general, my understanding is that this underlying issue a bug in Safari and is outside of Workbox’s control, and which is being tracked by the Webkit bugs linked to above.
Question: Q: fetchevent
FetchEvent.respondWith. received an error: Returned response is null. WebkitServiceWorker:0
MacBook Pro TouchBar and Touch ID, macOS Mojave (10.14.1)
Posted on Nov 30, 2018 8:57 AM
Helpful answers
I don’t see any software that normally causes problems. The Safe Mode boot may have fixed the problem since you posted the site is okay. The Safe Mode will reset some caches, forces a directory check, and is a general reset.
There’s more to the conversation
Loading page content
Page content loaded
Try going to Safari/Preferences/Privacy/Website Data and delete the cookie(s) for the site. Quit/reopen Safari and test.
Go to Safari Preferences/Extensions and turn all extensions off. Quit/reopen Safari and test. If okay, turn the extensions on one by one until you figure out what extension is causing the problem.
Try another browser as a test.
Try setting up another admin user account to see if the same problem continues. Please post back on whether or not this worked. Also try the Safe Mode. Please post back on whether or not this worked.
If it works in the Safe Mode, try running this program when booted normally and then copy and paste the output in a reply. The program was created by Etresoft, a frequent contributor. Please use copy and paste as screen shots can be hard to read. Click “Share Report” button in the toolbar, select “Copy to Clipboard” and then paste into a reply. This will show what is running on your computer. No personal information is shown.
Nov 30, 2018 10:10 AM
EtreCheck version: 5.0.9 (5A020)
Report generated: 2018-11-30 21:00:51
Download EtreCheck from https://etrecheck.com
Runtime: 1:57
Performance: Excellent
Problem: Other problem
Description:
FetchEvent.respondWith. received an error: Returned response is null. WebkitServiceWorker:0
Major Issues: None
Minor Issues:
These issues do not need immediate attention but they may indicate future problems.
Hardware Information:
MacBook Pro (15-inch, 2016)
MacBook Pro Model: MacBookPro13,3
1 2,7 GHz Intel Core i7 (i7-6820HQ) CPU: 4-core
Video Information:
Color LCD 3360 x 2100
Drives:
Internal PCI-Express 8.0 GT/s x4 NVM Express
disk0s2 [APFS Container] 499.96 GB
disk1 [APFS Virtual drive] 499.96 GB (Shared by 4 volumes)
Mounted Volumes:
Mount point: /private/var/vm
Network:
Interface lpss-serial1: LPSS Serial Adapter (1)
Interface lpss-serial2: LPSS Serial Adapter (2)
Interface en0: Wi-Fi
Interface en5: Bluetooth PAN
Interface bridge0: Thunderbolt Bridge
iCloud Quota: 61.62 GB available
System Software:
macOS Mojave 10.14.1 (18B75)
Time since boot: Less than an hour
Security:
System | Status |
---|---|
Gatekeeper | Enabled |
System Integrity Protection | Enabled |
System Launch Agents:
[Not Loaded] | 15 Apple tasks |
[Loaded] | 185 Apple tasks |
[Running] | 99 Apple tasks |
System Launch Daemons:
[Not Loaded] | 36 Apple tasks |
[Loaded] | 187 Apple tasks |
[Running] | 112 Apple tasks |
Launch Agents:
Launch Daemons:
User Launch Agents:
User Login Items:
Internet Plug-ins:
Silverlight: 5.1.50901.0 (installed 2018-09-30)
AdobeAAMDetect: 3.0.0.0 (installed 2018-06-14)
QuickTime Plugin: 7.7.3 (installed 2018-10-30)
Time Machine:
Time Machine information not available without Full Drive Access.
Performance:
System Load: 1.55 (1 min ago) 2.27 (5 min ago) 1.22 (15 min ago)
Nominal I/O speed: 10.06 MB/s
File system: 18.71 seconds
Write speed: 1959 MB/s
Read speed: 2677 MB/s
CPU Usage:
Type | Overall | Individual cores | |||||||
System | 1 % | 4 % | 0 % | 2 % | 0 % | 2 % | 0 % | 1 % | 0 % |
User | 2 % | 5 % | 0 % | 3 % | 0 % | 3 % | 0 % | 1 % | 0 % |
Idle | 97 % | 90 % | 100 % | 94 % | 100 % | 96 % | 100 % | 98 % | 100 % |
Top Processes by CPU:
Process (count) | Source | CPU | Location |
genatsdb | Apple | 31.00 % | |
appstoreagent | Apple | 16.20 % | |
WindowServer | Apple | 7.92 % | |
EtreCheckPro | Etresoft, Inc. | 5.58 % | |
cloudphotosd | Apple | 4.58 % |
Top Processes by Memory:
Process (count) | Source | RAM usage | Location |
com.apple.WebKit.WebContent (9) | Apple | 1.05 GB | |
EtreCheckPro | Etresoft, Inc. | 593 MB | |
mdworker_shared (18) | Apple | 509 MB | |
kernel_task | Apple | 400 MB | |
Spotify Helper (3) | Spotify | 301 MB |
Top Processes by Network Use:
Process | Source | Input | Output | Location |
Spotify | Spotify | 11 MB | 321 KB | |
biometrickitd | Apple | 20 KB | 167 KB | |
Dropbox | Dropbox, Inc. | 93 KB | 91 KB | |
com.apple.iCloudHelper | Apple | 39 KB | 8 KB | |
mDNSResponder | Apple | 25 KB | 20 KB |
Virtual Memory Information:
Available RAM | 10.01 GB |
Free RAM | 6.50 GB |
Used RAM | 5.99 GB |
Cached files | 3.51 GB |
Swap Used | 0 B |
Software Installs (past 30 days):
Name | Version | Install Date |
Microsoft Outlook for Mac | 16.16.18111001 | 2018-11-14 |
Microsoft PowerPoint for Mac | 16.16.18111001 | 2018-11-14 |
Microsoft OneNote for Mac | 16.16.18111001 | 2018-11-14 |
Microsoft Excel for Mac | 16.16.18111001 | 2018-11-14 |
Microsoft Word for Mac | 16.16.18111001 | 2018-11-14 |
Microsoft AutoUpdate | 4.5.18110402 | 2018-11-15 |
HueMenu | 1.9.1 | 2018-11-17 |
Diagnostics Information (past 7 days):
Service Worker FechtEvent.respond с нулевым ответом на iOS 12.1 Safari
Я могу скачать сайт, используя сервис Worker на Android Chrome, MacOS Chrome, а также Safari и на Windows Chrome для автономного использования. Когда я пытаюсь загрузить сайт в iOS 12.1 Safari, он сначала работает. Но когда я закрываю Safari, перехожу в автономный режим и снова открываю Safari, я получаю следующее сообщение об ошибке:
Ошибка: «FetchEvent.respondWith получил ошибку: Ошибка типа: Кажется, нет подключения к Интернету».
FetchEvent.respondWith получил ошибку: возвращенный ответ является нулевым
Ниже вы можете увидеть сценарии в текстовом виде. К сожалению, я едва ли могу что-либо сообщить о проблеме, потому что я не понимаю ее и надеюсь на некоторых знающих людей 🙂
Извините, у меня пока нет ответа, но у меня возникла та же проблема с моим веб-приложением, и я потратил на это часы. Поэтому я хотел бы опубликовать все свои выводы здесь.
Шаги, чтобы проверить, может ли веб-приложение работать в автономном режиме в iOS 12
посетите веб-сайт с Safari (iOS 12 или 12.1) закрыть вкладку сайта в Safari нажмите кнопку домой на iPhone, чтобы установить Safari в качестве фона нажмите кнопку питания iPhone, чтобы выключить экран нажмите кнопку питания iPhone снова, чтобы разбудить телефон отключите все сетевое соединение от центра управления iPhone (как Wi-Fi, так и сотовой связи) откройте Safari, зайдите на сайт снова → он должен работать в автономном режиме.
iOS 12 против iOS 11.3
Кажется, эта проблема появилась в iOS 12. Мое веб-приложение (https://viewsbyme.com) отлично работало в автономном режиме на iOS 11.3, в которой мобильная версия Safari впервые представила Service Worker, но получила ответы от iOS 12 и iOS 12.1, когда не в сети:
Safari не может открыть страницу. Ошибка была: «FetchEvent.respondWith получил ошибку: Ошибка типа: Интернет-соединение, кажется, в автономном режиме.».
Не уверен, связано ли это с этим сообщением об ошибке (оно говорит «RESOLVED FIXED», но на самом деле еще нет, если вы прокрутите вниз до конца потока):
Примеры работающих и не работающих веб-приложений
В качестве примера, эти 2 PWA могут работать в автономном режиме в iOS 12:
И эти 2 PWA не могут работать в автономном режиме в iOS 12 (но они отлично работают в Chrome на других платформах):
Это кажется простым, если сравнить сценарии Service Worker между этими PWA и выяснить, что заставляет их работать, а не работать. Но я еще не разобрался в дельте.
Ночные Работники Службы | Интерфейс FetchEvent
У работников службы есть важная функциональное событие выборки — fetch. Для события выборки fetch работники службы используют интерфейс FetchEvent, который расширяет интерфейс ExtendableEvent.
Каждое событие, использующее интерфейс FetchEvent, имеет связанный потенциальный ответ (potential response — ответ), изначально установленный на null, и следующие связанные флаги, которые изначально не установлены:
4.5.1. Атрибут event. request
Атрибут запроса request должен возвращать значение, которым он был инициализирован.
4.5.2. Атрибут event. preloadResponse
Атрибут preloadResponse должен возвращать значение, которым он был инициализирован. Когда создается событие, атрибут должен быть инициализирован обещанием, разрешенным с помощью undefined.
4.5.3. Атрибут event. clientId
Атрибут clientId должен возвращать значение, которым он был инициализирован. При создании события атрибут должен быть инициализирован пустой строкой.
4.5.4. Атрибут event. resultingClientId
Атрибут resultClientId должен возвращать значение, которым он был инициализирован. При создании события атрибут должен быть инициализирован пустой строкой.
4.5.5. Атрибут event. replacesClientId
Атрибут replacesClientId должен возвращать значение, которым он был инициализирован. При создании события атрибут должен быть инициализирован пустой строкой.
4.5.6. Атрибут event. handled
Атрибут handled должен возвращать значение, которым он был инициализирован. Когда создается событие, атрибут должен быть инициализирован как ожидающее обещание.
4.5.7. Метод event. respondWith ( r )
Разработчики могут установить аргумент r либо с обещанием, которое разрешается с помощью объекта Response, либо с объектом Response (который автоматически преобразуется в обещание). В противном случае в Fetch возвращается сетевая ошибка. Проверки безопасности на стороне средства визуализации на предмет заражения для содержимого из разных источников привязаны к типам отфильтрованных ответов, определенных в Fetch.
Шаги метода responseWith ( r ):
event. respondWith ( r ) по умолчанию продлевает время жизни события, как если бы вызывается event. waitUntil ( r ).
Если установлен флаг ошибки ответа, сетевая ошибка возвращается в Fetch через алгоритм «Обработки Выборки» (Handle Fetch). (См. Шаг 21.1.) В противном случае response значения возвращается в алгоритм Fetch через алгоритм «Обработки Выборки«. (См. Шаг 22.1.)
1. Утверждение: чанк chunk — это Uint8Array.
1. Установите end-of-body в значение true.
Не гарантируется, что данные, записанные работником службы частями, будут считываться идентичными фрагментами клиентом, который получает данные. То есть клиент будет читать те же данные, которые были записаны, но браузер может их разбить по-разному.
FetchEvent for «[url]» resulted in a network error response: the promise was rejected
The FetchEvent for «https://www.googletagmanager.com/gtag/js?id=UA-4562443-3» resulted in a network error response: the promise was rejected. Promise.then (async) (anonymous) @ service-worker.js:228 service-worker.js:1 Uncaught (in promise) fetch failed 1:21 GET https://www.googletagmanager.com/gtag/js?id=UA-4562443-3 net::ERR_FAILED The FetchEvent for «https://fonts.googleapis.com/css?family=Open+Sans:300,400&display=swap&subset=cyrillic» resulted in a network error response: the promise was rejected. Promise.then (async) (anonymous) @ service-worker.js:228 service-worker.js:1 Uncaught (in promise) fetch failed 1:28 GET https://fonts.googleapis.com/css?family=Open+Sans:300,400&display=swap&subset=cyrillic net::ERR_FAILED The FetchEvent for «https://widget.uservoice.com/VuHfPZ0etI2eQ4REt1tiUg.js» resulted in a network error response: the promise was rejected. Promise.then (async) (anonymous) @ service-worker.js:228 service-worker.js:1 Uncaught (in promise) fetch failed 1:894 GET https://widget.uservoice.com/VuHfPZ0etI2eQ4REt1tiUg.js net::ERR_FAILED
It actually works pretty well. I am able to get a fully working PWA icon in Audits in Chrome Dev Tools. Which is great, but after a refresh I am getting all those errors. My service-worker.js which is located at root of my website looks like this
I am guessing the problem comes from loading those external libraries. So, this is my code loading those libraries.
What should i do in order to fix those errors. This is my first try in PWA so i am lost.