Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when i upload to heroku #24

Open
tamirvardi1123 opened this issue May 24, 2022 · 2 comments
Open

when i upload to heroku #24

tamirvardi1123 opened this issue May 24, 2022 · 2 comments

Comments

@tamirvardi1123
Copy link

No description provided.

@tamirvardi1123
Copy link
Author

I get h10 error

022-05-24T03:21:02.792785+00:00 heroku[web.1]: State changed from starting to crashed
2022-05-24T03:21:13.558318+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/"
it successfully builds and deploys but when i visit site on heroku
doesnt work

@CodeLikeAGirl29
Copy link

do you have a Procfile

Bug in Procfile
A very interesting discovery for me. A bug in your Procfile can crash your app. If your Procfile is pointing to the wrong server file. e.g If your server is in server.js and your Procfile points to app.js this would definitely crash your app and Heroku would greet you with the H10-App crashed error code message.

Secondly, a buggy Procfile can also come in the form of wrong spacing.

Wrong: web : node index.js
Correct web: node index.js

Setting a PORT as a Heroku environment variable
This would surely crash your app. Heroku automatically sets a Port that can be accessed via process.env.PORT. Setting a port yourself would crash your app. Surprisingly, the command heroku config does not display the preset Heroku port so one might be tempted to set another port as an environment variable.
To see all the preset Heroku environment variables, use the command heroku run printenv.

Missing Required Environment Variable while setting a port would cause this error because Heroku already sets a port internally, failing to set any required environment variable (e.g your database), would prompt Heroku to greet you with this error.

Missing Required Scripts
This error is thrown in a Node.js environment if you forget to set a start script. Heroku uses this script to start your app so if it is missing, it would throw an H10-App crashed error code message.

This can be solved by setting a start script in the package.json

"scripts": {
   "start": "node index.js"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants