Straight up, the same code deployed two different ways:
npm run dev on my localhost https://02e7822e.ngrok.io
npm start (I assume) on Google App Engine https://testing-234701.appspot.com/
I have to stress that this is the same code being deployed (obviously very much tailored in package.json to deploy to App Engine) but only one of them looks correct.
I'm sure we're all thinking it's a problem with package.json, so I'll include it below, but if anyone has ever encountered a similar problem where a nodejs app looks fine on localhost but then looks like shit on deploy, PLEASE LET ME KNOW!
Chrome Console error: Failed to load resource: https://testing-234701.appspot.com/%7BsummarAIze%7D/_next/static/6MuW3BriROYrhZZCL~v03/pages/index.jsthe server responded with a status of 404 ()
^note, the resource that wasn't loaded deals with _next, so it must be related to next.js
package.json
{
"name": "hps_prework",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "node app.js",
"build": "next build",
"start": "NODE_ENV=production && node app.js",
"gcp-build": "npm run build",
"deploy": "npm run build && gcloud app deploy"
},
"engines": {
"node": ">10.0"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@material-ui/core": "^3.9.2",
"@material-ui/icons": "^3.0.2",
"babel-loader": "^8.0.5",
"jquery": "^3.3.1",
"js-cookie": "^2.2.0",
"koa": "^2.7.0",
"koa-session": "^5.10.1",
"next": "^8.0.3",
"python-shell": "^1.0.7",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-scripts": "^2.1.8",
"webpack": "^4.28.3"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
I should also note that I took some inspiration for my package.json scripts from this prev SO question: Deployed a Next.js application to App Engine Standard [Nodejs] and got a 500 error
I am deploying to App Engine with gcloud app deploy
and the logged output from that doesn't show any problems. It's just when the webpage is loaded, everything's just broken.
Edit: I also don't know if this is helpful at all, but I deployed the same app to AWS Elastic Beanstalk and the process was so much easier. The website loaded the same way as it did on my localhost, and AWS EB even lets the user change the npm command used to run the website, which Google App Engine doesn't seem to support.