Search code examples
node.jsreactjspostgresqlgithubheroku

Heroku App rollback works but identical code does not - works perfectly locally


I have a Node.js app running a React front-end hosted on Heroku which is linked to a Github repository so that on push it redeploys the app. I have been using the app this way without problem for around a year now.

It works on Heroku Local, and running the node app locally without Heroku but I'm getting a 503 service unavailable error when I run a put request when running the app online.

2021-06-01T08:04:27.326913+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=PUT path="/api/auth/login" host=myapp.herokuapp.com request_id=9b84f5c5-def4-4dce-82d2-baf1bef3a9a8 fwd="90.215.204.78" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https

Any pointers?


Solution

  • It was fixed by adding a Procfile with: "web:server/index.js" as well as specifying the Node version specifically changing the code in my package.json from:

    "engine":"12.x",

    to:

    "engines": { "node":"v12.18.3" },

    I think it is likely the package.json change that ultimately fixed the problem.