-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Service worker register don't fetch the ngsw.json correctly #8516
Comments
Just to link the related bug: |
I guess this is an issue in |
How is this different then #8515? |
@hansl
the error appear at runtime on So, @svi3c is right. Is a problem at
I don't know if is needed 2 different issues, but feel free to close one if want to. |
When the service worker try to load the manifest use an absolute path. const res = await this.safeFetch(this.adapter.newRequest('/ngsw.json?ngsw-cache-bust=' + Math.random())); Changing that to a relative path (will be relative to the service worker path) do the work. The browser will do all the path resolution work. const res = await this.safeFetch(this.adapter.newRequest('ngsw.json?ngsw-cache-bust=' + Math.random())); UPDATE: |
I am getting 401 Unauthorized status code back. Any ideas how to work around that?:
|
Hi , I followed the steps from below link but I have loaded project to git and using azure for hosting with jenkins build but getting below error: |
Hi, |
Yes @aonerd. Add .scm to your website address,which navigates to settings ,if web.config is already exist add the content or create new file(Web.config) in the below folder path. |
@Vinutha-BK Hi, can you let me know, what version of service worker you are using. Actually, I am getting this error in local as well. ngsw-worker.js:2187 Uncaught (in promise) Error: Manifest fetch failed! Thanks, |
Oh ,my bad I was not running ngsw-config command on top of build hence service worker was not running. Now, its fine. BTW, I have used "manifest.webmanifest" just to ignore any server side web.config changes to allow json file to get downloaded |
I also facing the same issue. Anybody knows how to fix this issue? Mine was deployed on tomcat 8 server. |
This has been fixed with angular/angular@f582620. The fix is available since 5.1.x. |
Not true. This is still not fixed. I'm using 1.7.4 and 5.2 and this is still happening when using IIS as the host. |
Are you saying this only happens with IIS? (Sounds like a different issue.) |
@gkalpak I have a similar issue with spring-boot, seems to give 401 for some reason. Appears to be a very similar issue.
That is the newer line in the same file. I have allowed this file in the spring-boot config. Under normal circumstances it fetches it fine, testing under Lighthouse it fails. |
While not resolved, I figured out that if I used Windows Auth in IIS, I would get this 401 error, which makes sense. So only having Anonymous turned on works. Is there a way to have the service worker add { useCredentials: true} in the header when using fetch? |
I'm not entirely sure what the issue is, when I request the manifest from the address bar, it loads fine, however when it is requested by the Request interface (that's what the adapter uses) it gives me a 401. I'm guessing it's not supplying maybe the XSRF header or a similar issue. As I have a very fixed static manifest, I've hard coded that in the worker's return, irrespective of the error code. A huge hack, but it's got me past the issue. |
This sounds like a different issue (401 vs 404). It is related to authentication, since the current |
@gkalpak Thanks for the clarification, yes this is a 401 issue. I see in this ticket that there were mentions of 401s, hence my input. |
It seems that this issue is back. Well, my tolling versions: Angular CLI: 6.2.0-beta.2 The solution @aonerd provided worked for me. It seems more an issue with Azure App Service than with Angular itself. Does anyone have ideas? For example, if deploying the Angular App via vscode/devenv to App Service, should vscode/devenv suggest the dev to add a Web.Config with these static files configuration? Should App Service serve json files as static files by default? |
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. |
Bug Report or Feature Request (mark with an
x
)Versions.
Repro steps.
replace the line 16 of
app.module.ts
to:environment.production ? ServiceWorkerModule.register('/project/ngsw-worker.js') : []
(this is another bug #8515)
then
Publish the dist folder to a web server with a base url /project/
Ex: http://localhost/project/
The log given by the failure.
At console:
At network of chrome devtools it gives 404 since can't found
http://localhost/ngsw.json?ngsw-cache-bust=0.32248277017838034
.Desired functionality.
The right address of fetch should be
http://localhost/project/ngsw.json?ngsw-cache-bust=0.32248277017838034
Mention any other details that might be useful.
At line 2141 of
ngsw-worker.js
file, it should consider the base-href.The text was updated successfully, but these errors were encountered: