trying to deploy a mern app. I built the front-end following the create-react-app docs, placed the build in the backend and proceeded to follow the instructions provided by fly. I deployed my app initially via the launch + deploy command, at this stage I received no errors and the website was running fine.
After this I made some changes, deployed again by using “flyctl deploy”, which succeeded. However, now when I visit the website it comes up as a blank page with the error specified in the title. When I manually visit pages via inputting the routes (like /login) they work, but the home page (?), is blank.
My current work around is re-launching every time, however this is a bit cumbersome.
Where do you see that error? Is the homepage doing any API requests?
Sorry, was trying to set up another project to replicate this issue.
Under the networks tab, the requests made in the homepage seem to succeed.
However, the page is blank with this error: ‘Uncaught SyntaxError: Unexpected token ‘<’ (at main.d01d4983.js:1:1)’
Checking the main.d01d4983.js file it seems to start like this: “<!doctype html>…”
This is different from the .js file for the working website.
When visiting routes like ‘/login’ it returns the correct .js file.
I didn’t get this error when I changed the backend and re-deployed, but I got it when I tried to change the frontend (just added a console.log statement), re-built and re-deployed
So it works when I add
“homepage” : “.”
to the package.json of the react app, however, deploying it now I have issues refreshing certain pages (I get the same syntaxerror). So then I went back and removed the homepage attribute entirely, built it and deployed again. At this point it works. No idea how that is.