🌐 웹개발/웹 개발
[Heroku] Application Error | 헤로쿠에 .env 환경 변수 파일 올리기
두_두
2023. 1. 31. 14:06

더보기
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check yout logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
헤로쿠에 배포를 하고 heroku open을 뙇 해서 확인을 하려 하는데 에러가 떴다.
.gitignore에 몽고DB KEY 등등.. 중요한 환경 변수들을 저장해놓은. env파일을 입력해두었는데
이것이 헤로쿠 서버에 적용이 안되어서 생긴 문제였다.
.env 파일의 환경 변수를 헤로쿠에 적용시켜주는 heroku-dotenv를 설치해서 환경변수를 전달해주니까 바로 해결되었다!
$ npm i -g heroku-dotenv
$ heroku-dotenv push
heroku-dotenv
Copies environment variables in a .env file to and from Heroku. Latest version: 0.4.1, last published: 5 years ago. Start using heroku-dotenv in your project by running `npm i heroku-dotenv`. There are no other projects in the npm registry using heroku-dot
www.npmjs.com
728x90