IT TIP

첫 번째 Heroku 배포 실패 ʻerror code = H10`

itqueen 2020. 10. 22. 23:48
반응형

첫 번째 Heroku 배포 실패 ʻerror code = H10`


내 앱을 Heroku에 배포했습니다. node.js + express + socket.io 앱이고 이것은 package.json파일입니다.

{
  "name": "game_test",
  "author": "Ilya",
  "description": "A test app for our board game",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node app"
  },
  "dependencies": {
    "express": "3.0.6",
    "jade": "*",
    "socket.io" : "*"
  },
 "engines": {
      "node": "0.8.14"
  }
}

이것은 내가 얻는 로그입니다.

heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=game-test-1.herokuapp.com fwd=37.26.146.185 dyno= queue= wait= connect= service= status=503 bytes=
heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=game-test-1.herokuapp.com fwd=37.26.146.185 dyno= queue= wait= connect= service= status=503 bytes=

무슨 뜻이에요?


나를위한 해결책을 찾았습니다 : Heroku + node.js 오류 (시작 후 60 초 이내에 웹 프로세스가 $ PORT에 바인딩하지 못했습니다)

제 경우에는 heroku dinamicaly가 설정하는 포트를 사용하는 대신 PORT를 설정하기가 어렵 기 때문에 앱이 충돌했습니다. process.env.PORT

app.listen(process.env.PORT || 3000, function(){
  console.log("Express server listening on port %d in %s mode", this.address().port, app.settings.env);
});

내 앱에서 비슷한 문제가 발생했습니다. 많은 옵션을 시도한 후 DB 마이그레이션 후 문제가 발생했습니다.

heroku restart

(Mac 용 Heroku toolbelt 사용)


내 경우에는 process.env.PORT || 3000http 서버 스크립트에 추가 하여 해결했습니다. 내 heroku 로그에 'H20'오류와 503 http 상태가보고되었습니다.


제 경우에는 로컬 컴퓨터에 node와 npm의 버전 차이가 있고 package.json 버전에 정의되어 있기 때문에 동일한 오류를 발견했습니다.

"engines": {
  "node": "0.8",
  "npm": "1.2.x"
}

내가 사용할 때

node --version : v0.10.41
npm --version : 1.4.29

내 package.json을 업데이트하면

 "engines": {
  "node": "0.10.41",
  "npm": "1.4.29"
}

잘 작동합니다 :)


또한 데이터베이스 연결을 확인하십시오. 나는 localhost에서 데이터베이스 연결을 변경하는 것을 잊었고 heroku로 푸시되면 내 앱이 충돌했습니다.


제 경우에는 Procfile이 잘못된 파일 (이전에 사용한 bot.js)을 가리키고 있었기 때문에 업데이트하면 오류가 사라졌습니다.


나는이 같은 문제에 직면했고 위의 답변 중 어느 것도 나를 도왔습니다. 내가 한 일은 다음과 같습니다.

node --version

package.json에서 노드 버전과 함께 engines 섹션을 추가하십시오.

{
  "name": "myapp",
  "description": "a really cool app",
  "version": "1.0.0",
  "engines": {
    "node": "6.11.1"
  }
}

나는이 문제가 있었고 유일한 문제는 내 Procfile이었습니다.

web : node index.js

그리고 나는

web:node index.js

유일한 문제는 공백이었다


In my own case, i got this error because i refuse to add a Procfile to my node js app and my "main": "app.js" was initially pointing to another js file as main. so doing these chnages get it fixed for me


I had a typo

const PORT = process.env.PORT||'8080';

used to be

const PORT = process.env.port||'8080';


In my case, I forgot to set database env for deployment. you can set env by this command (I'm using mLab for MongoDB server)

heroku config:set MONGO_URI='mongodb://address'


For me it was Package.json it was empty from dependencies even though i thought i did install them.. so I had to reinstall them with --save option in the end and verify they were added to the package.json.. and then push it again and it worked.


If you locally start node server by nodemon, like I did, and it locally works, try npm start. Nodemon was telling me no errors, but npm start told me a lot of them in a understandable way and then I could solve them by following another posts here. I hope it helps to someone.


In my case there was no start command in the script section of package.json file. When I created the package.json file with npm init I did not create a start script command. So I went to the package.json file, under scripts I added a new entry:

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

Saved it and uploaded to Heroku and it worked


Password contained a % broke it for me.


My port was set to config.httpPort which resolves to 80. I fixed it by doing this:

const PORT = process.env.PORT || config.httpPort;

app.listen(PORT, ...)

Thanks a lot, it wasted me a lot of hours last night.


The H10 error code could mean many different things. In my case, the first time was because I didn't know that Heroku isn't compatible with Sqlite3, the second time was because I accidentally pushed an update with Google analytics working in development as well as production.


I got the same above error as "app crashed" and H10 error and the heroku app logs is not showing much info related to the error msg reasons. Then I restarted the dynos in heroku and then it showed the error saying additional curly brace in one of the index.js files in my setup. The issue got fixed once it is removed and redeployed the app on heroku.


Older thread, but for me I didn't set my .env vars in the Heroku console.


i was using body-Parser that throw exception

const bodyParser = require('body-Parser')    
//Bodyparser Middleware
app.use(bodyparser.json())

intead of using

    //Bodyparser Middleware
    app.use(express.json())

this resolved my issue


I want to register here what was my solution for this error which was a simple file not updated to Github.

I have a full stack project, and my files are structured both root directory for backend and client for the frontend (I am using React.js). All came down to the fact that I was mistakenly pushing the client folder only to Github and all my changes which had an error (missing a comma in a object's instance in my index.js) was not updated in the backend side. Since this Heroku fetches all updates from Github Repository, I couldn't access my server and the error persisted. Then all I had to do was to commit and push to the root directory and update all the changes of the project and everything came back to work again.

참고URL : https://stackoverflow.com/questions/14322989/first-heroku-deploy-failed-error-code-h10

반응형