I have a react app that built through npm run build. GET and POST request from the front-end to back-end gives status 200 but I am getting a weird error that may cause all the i
I had the same problem when I moved my Codesandbox project to local. In my case, there was no manifest.json
file in the public
folder.
I solved it by adding the default manifest.json
that create-react-app
generates:
{
"short_name": "CloseWeUI",
"name": "The front-end UI for CloseWe",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
I had the same problem ("Manifest: Line: 1, column: 1, Syntax error") while running my app (react app with react-router, published with AWS Amplify).
My problem was fixed by doing the following: In "Rewrites and redirects" make sure you have "json" in the following line:
Source address:
</^[^.]+$|\.(?!(css|gif|ico|json|jpg|js|png|txt|svg|woff|ttf)$)([^.]+$)/>
Target address:
/index.html
Type:
200 (Rewrite)
The above solution also fixed problem with non-working react-router links in production as it was reported in the following thread: React Router DOM not working correctly on Amplify Console AWS
Here is to my personal project with fixed manifest.json issue, as well as non-working react-router issue (a link to some random code snippet - fibonacci memoization in this case):
https://everhint.com/hintlink/algorithms/javascript/codesnippet/fibonacci/memoization/fibonacci-memoization/d01f275b-6acf-4f26-9448-e99939c9d4b7.html
As I added password protection to a developer-only page of mine, I suddenly started getting "manifest line 1 column 1 syntax error" (manifest.json) errors.
I am also using AWS Amplify as well as Create React App to build my app. I tried all of the solutions above, but nothing helped.
The one thing that did help was adding one property to the link to my manifest.json in my index.html.
To solve this, I added crossorigin="use-credentials"
*, like below:
<link crossorigin="use-credentials" rel="manifest" href="./manifest.json" />
VladS answer solved my problem. I was also using AWS Amplify Console for my Angular App.
You can also have a look at the Content-Type in the response headers of your manifest file. It should NOT be text/html
. If it is, you have to change your server configuration to serve the file in the right Content-Type. More info
Angular names the Manifest-File "manifest.webmanifest". So I also had to go to the "Rewrites and redirects" Page in the Amplify Console and edited the existing entry like so:
Source address
</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|json|webmanifest)$)([^.]+$)/>
(I added json|webmanifest)
I actually just wanted to add a comment to mtw's post but my reputation doesn't allow for it. I was also able to fix it by adding json|webmanifest to the handlers in the app.yaml file (Angular 9 app on Google Cloud hosting platform) like so...
handlers:
- url: /(.*\.(gif|png|jpg|css|js|svg|json|webmanifest)(|\.map))$
secure: always
redirect_http_response_code: 301
static_files: dist/\1
upload: dist/(.*)(|\.map)