DEV Community

loading...

How to deploy an Express app for free?

davinaleong profile image Davina Leong ・2 min read

Hi, I'm trying my hand at some simple deployment. I'm new to deployment and DevOps in general.

I'm trying to deploy this repo on Heroku, but the app keeps crashing when I run the logs:

heroku logs --tail
Enter fullscreen mode Exit fullscreen mode

Logs:

2020-01-20T13:22:48.461520+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2020-01-20T13:22:48.530567+00:00 heroku[web.1]: Process exited with status 143
2020-01-20T13:22:49.039979+00:00 app[web.1]: Welcom to GraphQL JS!
2020-01-20T13:23:47.885144+00:00 heroku[web.1]: State changed from starting to crashed
2020-01-20T13:23:47.785166+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-01-20T13:23:47.785166+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-01-20T13:23:47.868166+00:00 heroku[web.1]: Process exited with status 137
2020-01-20T13:25:22.662912+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=calm-cove-11715.herokuapp.com request_id=45fc8325-868d-4daa-b67e-177a355ecfe5 fwd="116.14.82.68" dyno= connect= service= status=503 bytes= protocol=https
2020-01-20T13:25:23.026635+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=calm-cove-11715.herokuapp.com request_id=6444cb61-eae0-4116-9b36-861ad1aef465 fwd="116.14.82.68" dyno= connect= service= status=503 bytes= protocol=https
Enter fullscreen mode Exit fullscreen mode

What is happening, and how to I resolve this? I'm also trying to follow this tutorial on Heroku.

Discussion (2)

pic
Editor guide
Collapse
mattiascibien profile image
Mattias Cibien • Edited

Every thing you deploy on heroku must be listening on $PORT. You should get it by querying the environment variable inside your express app.

I suggest you check devcenter.heroku.com/articles/depl...

Collapse
mattiascibien profile image
Mattias Cibien

You can also see how to do that in the heroku help help.heroku.com/P1AVPANS/why-is-my...