sooraj s pillai
sooraj s pillai

Reputation: 916

Deploying nextjs app on Heroku - error status H20

I'm new to react and nextjs. I managed to develop a simple website in nextjs and when i build the project in local system using npm run build without any error it works properly then i tried to deploy in heroku in the dashboard it shows build succeded and deployed but when i check the project using the given link it shows application error. After i check the heroku logs its shows Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch like this. By checking some threads about this link i managed to restart heroku but no use still the same problem. Also i've changed the port from 3000 to 5000 by changing in package.json .It'll be so helpfull if anyone point out the issue.

  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start -p 5000"
  },

This is my heroku log

2020-07-24T05:14:15.020173+00:00 heroku[web.1]: Starting process with command `npm start`
2020-07-24T05:14:17.215400+00:00 app[web.1]:
2020-07-24T05:14:17.215416+00:00 app[web.1]: > [email protected] start /app
2020-07-24T05:14:17.215416+00:00 app[web.1]: > next start
2020-07-24T05:14:17.215416+00:00 app[web.1]:
2020-07-24T05:14:17.458010+00:00 app[web.1]: ready - started server on http://localhost:3000
2020-07-24T05:14:37.208072+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=abcapp.herokuapp.com request_id=55de2c51-58d2-430d-883d-7a1bc05cecfc fwd="157.46.187.156" dyno= connect= service= status=503 bytes= protocol=https
2020-07-24T05:15:15.482693+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-07-24T05:15:15.502706+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-07-24T05:15:15.584970+00:00 heroku[web.1]: Process exited with status 137
2020-07-24T05:15:15.629010+00:00 heroku[web.1]: State changed from starting to crashed
2020-07-24T05:15:17.145562+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=abcapp.herokuapp.com request_id=9e610deb-8e1e-4ca6-9e60-7516bc36cd92 fwd="157.46.187.156" dyno= connect= service= status=503 bytes= protocol=https

Upvotes: 2

Views: 1937

Answers (1)

sooraj s pillai
sooraj s pillai

Reputation: 916

I've solved this issue by updating package.json like the below.

  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start -p $PORT"
  },

Upvotes: 6

Related Questions