U
U
ugar20002019-09-03 14:48:52
Angular
ugar2000, 2019-09-03 14:48:52

Unexpected token < in JSON error in ngsw?

Created a progressive web application. On localhost it works like a Swiss watch - it caches files, remembers requests, and installs the application manifest. But when on the server - Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0.
The Service-Worker registers, but the cache storage is empty.
Server with HTTPS, Apache-Tomcat-9.
5d6e5227b6d28138175984.png
My ngsw-config
{
"index": "/inspector/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/inspector/favicon.ico",
"
"/inspector/*.js",
"/inspector/*.json",
"/inspector/manifest.json",
"/inspector/assets/html/iframe.html",
"!/inspector/*-es5*. js"
],
"urls": [
" https://fonts.googleapis.com/** ",
" https://fonts.gstatic.com/s/** "
]
}
},
{
"name": " assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/inspector/assets/**",
"/inspector/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
]
}
}
]
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2019-09-03
@SagePtr

Apparently, you are requesting JSON with ajax, and instead of JSON, the server returns HTML code (for example, a standard web server error page like 503).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question