React - Express - Parcel ย ย ย ์กฐํฉ
2020-05-27T13:20:31.215293+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=.....
Web์ด๋ Heroku Dashboad ์ ์๋ฌ๋ก๊ทธ์๋ ์ ๋ณด๊ฐ ์๋ค. H10, 503, 404 ๋ฑ๋ฑ์ ์๋ฌ ๋ชจ๋ ์ด๋ ๋ถ๋ถ์์ ์ ~๋ฅผ ํ๋์ง ์ ์๊ฐ ์๋ค. ๊ทธ๋์, Heroku bash๋ก ๋ค์ด๊ฐ ์ง์ npm start๋ฅผ ํตํด bash์์ ๋ก๊ทธ๋ฅผ ๋ฝ์๋ณด์.
heroku run bash
npm start
์ด์ ์๋ฌ๊ฐ ์ค์ค์ค์ค์ค์ค์ค์ค ๋์จ๋ค. ์ผ๋จ ๋์ ๊ฒฝ์ฐ์๋ ์์ธ์ง parcel ์ด yarn์ ์ถ๊ฐ๋์ง ์์์ ์ค๋ฅ๊ฐ ๋์์ง๋ง parcel์ ์ถ๊ฐํด๋ ์๋ฌ๊ฐ ๋์จ๋ค.
2020-05-27T13:42:18.681445+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-05-27T13:42:18.699208+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-05-27T13:42:18.785862+00:00 heroku[web.1]: Process exited with status 137
2020-05-27T13:42:18.824711+00:00 heroku[web.1]: State changed from starting to crashed
๋ ๋ง์ด ์ค์ค์ค ๋์ค๋๋ฐ ์ฝ๋ค๋ณด๋ฉด ๋ญ๊ฐ ๋น๋๊ฐ ๋๋ฆฌ๊ฒ ๋์ด์ ํ๊ธฐ๋ ๊ฒ ๊ฐ๋ค. ๊ทธ๋ฐ๋ฐ ๋น๋๊ฐ yarn ํจํค์ง build๊ฐ ์๋๋ผ parcel ๋ช ๋ น์ด๋ก ์คํํ build๋ค. production์ ์ํด parcel์ด ๋น๋ํ ๋ ์ค๋๊ฑธ๋ ค์ ํฐ์ง๋ค๊ณ ๋์ถฉ ์ดํดํ๊ณ ๊ตฌ๊ธ๋ง ํด๋ณด๋ ๋ฃจํธ ํด๋์ package.json ์คํฌ๋ฆฝํธ์ Heroku์ ํฌ์คํธ๋น๋๋ฅผ ์ค์ ํด์ผ ๋๋ค๋๋
"scripts": {
.
.
.
"heroku-postbuild": "parcel build ./client/public/index.html"
},
index.html ์ ๋ด ํ๋ก์ ํธ ๊ฒฝ๋ก ์จ์ฃผ๊ณ .. ๋ค์ Heorku์ ํธ์ฌํ๋ฉด ์ ๋๋ก ๋์๊ฐ๋ค.
Parcel ๋ถ์ด๊ณ ๋์จ ์ค๋ฅ ๊ฐ๊ธดํ๋ฐ ๋ญ๊ฐ ์ด๋ฐ์๋ Parcel ์์์ด๋ ์ค๋ฅ ์ ๋์๋ ๊ฒ ๊ฐ๊ธฐ๋ ํ๊ณ .. ๋น๋ํ ํ์ผ์ด ์ปค์ง๋ฉด์ Parcel์ด Heroku ์ Deploy๋ฅผ ๋ฐ๋ผ์ก์ง ๋ชปํด์ ๋์์ ์๋ ์์ ๊ฒ ๊ฐ๋ค.