I just updated Angular from v18 to v19.
I got this error during fetch with Proxy. The backend endpoint is working with Postman.
How could I solve this?
Repo
https://github.com/krondorl/mtgbase
Frontend endpoint:
http://localhost:4200/card/1
Backend endpoint:
http://localhost:8080/api/card?id=1
Proxy conf:
{
"/api/cards": {
"target": "http://localhost:8080/",
"secure": false
},
"/api/cards/*": {
"target": "http://localhost:8080/",
"secure": false
},
"/api/card/*": {
"target": "http://localhost:8080/",
"secure": false
},
"/api/artists": {
"target": "http://localhost:8080/",
"secure": false
}
}
SyntaxError: Unexpected token '<', "<!--
* M"... is not valid JSON
at JSON.parse (<anonymous>)
at XMLHttpRequest.onLoad (http://localhost:4200/@fs/F:/Dev/mtgbase/frontend/.angular/cache/19.0.0/mtgbase-frontend/vite/deps/chunk-HRS2PV5Z.js?v=d5e5e7e7:1753:41)
at _ZoneDelegate.invokeTask (http://localhost:4200/polyfills.js:327:171)
at http://localhost:4200/@fs/F:/Dev/mtgbase/frontend/.angular/cache/19.0.0/mtgbase-frontend/vite/deps/chunk-ISXW4YOB.js?v=d5e5e7e7:5390:49
at AsyncStackTaggingZoneSpec.onInvokeTask (http://localhost:4200/@fs/F:/Dev/mtgbase/frontend/.angular/cache/19.0.0/mtgbase-frontend/vite/deps/chunk-ISXW4YOB.js?v=d5e5e7e7:5390:30)
at _ZoneDelegate.invokeTask (http://localhost:4200/polyfills.js:327:54)
at Object.onInvokeTask (http://localhost:4200/@fs/F:/Dev/mtgbase/frontend/.angular/cache/19.0.0/mtgbase-frontend/vite/deps/chunk-ISXW4YOB.js?v=d5e5e7e7:5599:25)
at _ZoneDelegate.invokeTask (http://localhost:4200/polyfills.js:327:54)
at ZoneImpl.runTask (http://localhost:4200/polyfills.js:135:37)
at ZoneTask.invokeTask [as invoke] (http://localhost:4200/polyfills.js:398:26)