New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to load resource: the server responded with a status of 504 (Gateway Timeout) #22362
Comments
I have ran into this same issue. Rather than open a new ticket, I will just add my findings here: It seems to happen when you open chrome devtools. I believe this is the line causing the problems, but not 100% sure:
here's the line that is being referenced by the error message: https://github.com/EreckGordon/angular-universal-pwa-starter-deploy/blob/master/dist/dist-browser/ngsw-worker.js#L1975 some googling shows me some other people that seem to have solved their issue in their own respective projects: thgh/sapper-template@cccd9b9 |
I have also run into the same problem (https://stackoverflow.com/questions/48828413/angular-service-worker-failed-to-load-resource-the-server-responded-with-a-st). In my case the error is triggered by the "request"/URL that initializes of my Angular 5 app (using hash style URLs, like: https://example.com/nightly/#/connect). As the part behind the # should usually never be sent to the server, I am surprised to find the (entire) URL in the fetch event of the service worker. There, the request has the following data: So according to the error message, the attributes "cache" and "mode" generated by my Angular app (HashLocationStrategy) are conflicting with the service worker fetch implementation of Chrome v64. I see 3 options here: a) Prevent Angular to send the init URL of its application (https://example.com/nightly/#/connect) to the service worker b) Prevent the service worker to do a fetch for the init URL of the Angular app c) Manipulate the attributes "cache" or "mode" either in the Angular app or the service worker to values not conflicting with Chrome v64. @EreckGordon & @chamikasandamal : Which are the URLs that trigger the error on your side? |
It seems to trigger for me on any url, only the first time opening dev tools while viewing the site. If you close the tab, then reopen the site and reopen dev tools the error appears again. I don't use hash routing. Here's a site demonstrating the issue: |
Under some circumstances (possibly related to opening Chrome DevTools), requests are made with `cache: 'only-if-cached'` and `mode: 'no-cors'`. These request will eventually fail, because `only-if-cached` is only allowed to be used with `mode: 'same-origin'`. This is likely a bug in Chrome DevTools. This commit avoids errors related to such requests by not handling them. Fixes angular#22362
Under some circumstances (possibly related to opening Chrome DevTools), requests are made with `cache: 'only-if-cached'` and `mode: 'no-cors'`. These request will eventually fail, because `only-if-cached` is only allowed to be used with `mode: 'same-origin'`. This is likely a bug in Chrome DevTools. This commit avoids errors related to such requests by not handling them. Fixes angular#22362
Under some circumstances (possibly related to opening Chrome DevTools), requests are made with `cache: 'only-if-cached'` and `mode: 'no-cors'`. These request will eventually fail, because `only-if-cached` is only allowed to be used with `mode: 'same-origin'`. This is likely a bug in Chrome DevTools. This commit avoids errors related to such requests by not handling them. Fixes angular#22362
I have also run into the same problem but in my case in local server http-server -p 8000 all images load. but when i upload dist folder to server first time load all images after soft refresh only https images load but http images not load. (when images load form service worker that time issue occurred). After hard refresh (Ctrl + Shift + r) all images load. why angular service worker not load http images? thanks in advance. |
@akilmakda, this sounds like a different issue. If you think it is related to |
Need open new issue? Demo application : https://github.com/akilmakda/PWA-not-work-in-HTTP.git |
@akilmakda, the error message (which comes from the browser, not (In any case, this issue is not the place to discuss unrelated problems. If you still think there is an issue with |
Create new issue #23012 |
Under some circumstances (possibly related to opening Chrome DevTools), requests are made with `cache: 'only-if-cached'` and `mode: 'no-cors'`. These request will eventually fail, because `only-if-cached` is only allowed to be used with `mode: 'same-origin'`. This is likely a bug in Chrome DevTools. This commit avoids errors related to such requests by not handling them. Fixes #22362 PR Close #22883
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a...
Current behavior
Angular service worker application throws following error
Expected behavior
It should not throw any exceptions
Minimal reproduction of the problem with instructions
ng new my-project --service-worker
ng build --prod
cd dist http-server -p 8080
Even with IIS host i can see the same issue.
What is the motivation / use case for changing the behavior?
Environment
The text was updated successfully, but these errors were encountered: