New issue
Advanced search Search tips

Issue 899192 link

Starred by 3 users

Issue metadata

Status: Duplicate
Merged: issue 823392
Owner: ----
Closed: Nov 2
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Pass-through service worker sometimes fails due to browser-provided options

Reported by a...@scirra.com, Oct 26

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3591.0 Safari/537.36

Steps to reproduce the problem:
Our PWA uses a Service Worker for offline support. Try it out at: https://editor.construct.net/r122

Sometimes Chrome sends a navigate fetch for the main page with the options:
cache: "only-if-cached",
mode: "no-cors"

Sometimes our SW responds with a pass-through fetch, i.e. fetch(event.request). This then fails with:
"Failed to execute 'fetch' on 'ServiceWorkerGlobalScope': 'only-if-cached' can be set only with 'same-origin' mode"

What is the expected behavior?
Chrome should not provide fetch event options that are incompatible with each other. fetch(event.request) should be a reliable way to pass through a fetch without having to first modify the options.

What went wrong?
It appears Chrome provided incompatible fetch options, so they would have to be changed for the fetch to succeed.

Did this work before? Yes not sure

Does this work in other browsers? Yes

Chrome version: 72.0.3591.0  Channel: canary
OS Version: 10.0
Flash Version: 

This does not appear to ever happen in Firefox or Edge.

It is difficult to come up with reliable steps to reproduce - it doesn't seem to always happen and the general stickiness of service workers makes it hard to investigate. A few reloads in incognito mode with "Pause on caught exceptions" enabled tends to hit it, but often you have to try several times in new windows.
 
I've observed this happening in both Canary 72.0.3591.0 and stable 70.0.3538.77. I am pretty sure it never used to happen so seems to be a regression introduced in the last few Chrome updates.
Labels: Target-72 FoundIn-70
That error message was added here: https://chromium-review.googlesource.com/c/chromium/src/+/758376

Given that it doesn't always happen, I wonder if Chrome generates a request with these options only in certain cases. I don't know what the expected cache and mode are for a navigation.
Labels: Needs-Triage-M72 Needs-Bisect
Labels: Triaged-ET Needs-Feedback
Tested the issue on reported chrome version #72.0.3591.0 using Windows 10 by following below steps.

Steps:
=====
1.Launched chrome.
2.Navigated to "https://editor.construct.net/r122".
3.Navigated to Devtools->Network tab and reloaded the page observed errors under the tab.
4.Tried searching cache: "only-if-cached" and mode: "no-cors" under console tab and network tab, but could not find them.

Attached screencast for reference.
@reporter: Could you please provide the screencast of the issue so that it would be really helpful for further triaging of the issue.
Thanks.!
899192.mp4
7.6 MB View Download
Cc: swarnasree.mukkala@chromium.org
Components: Platform>DevTools
Do you actually see failure in your loaded page or are you just getting unexplained error messages in the console?

I've seen something like this before.  I believe its devtools trying to load the page source, etc.  I think it uses only-if-cached so that it can show the last resource loaded by the page and not a potentially modified one from the server.
I'm not sure, because issue 899196 means there's tons of random failures, so it's hard to tell if this is one of them. I have definitely seen this after loading the page with dev tools closed, and then opened dev tools, and the error is in the middle of some past logs so presumably occurred some time while dev tools was closed.
Project Member

Comment 8 by sheriffbot@chromium.org, Oct 30

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
BTW I can reliably reproduce this with the following steps:

1. Open a new incognito window
2. Navigate to https://editor.construct.net/r122
3. Wait a few seconds
4. Open dev tools and look at console messages

I can always see the following message:

Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'ServiceWorkerGlobalScope': 'only-if-cached' can be set only with 'same-origin' mode
Labels: -Type-Bug-Regression FoundIn-72 M-72 FoundIn-71 OS-Linux OS-Mac Type-Bug
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on latest stable #70.3538.77, reported chrome version #72.0.3591.0 and latest chrome #72.0.3596.0 using Windows 10, Ubuntu 17.10 and Mac OS 14.0 by following steps as per comment #9.


The behavior is seen from old M-60 builds(#60.0.3112.113). This is a non-regression issue, hence marking it as Untriaged and requesting someone from the dev team to look into the issue.
Thanks.!
Labels: -Needs-Bisect
+correcting comment#10 in Mac OS version 10.14
If 'only-if-cached' message is a red herring due to DevTools I think we should fix DevTools to not show it. It's confusing debugging and triaging these issues.

OTOH it's strange that if this happened since M60 and no one noticed before.
I think I've seen the same bug / issues before,  issue 823392  looks same?
Mergedinto: 823392
Status: Duplicate (was: Untriaged)
Good find.

Sign in to add a comment