Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku process.env.port is undefined

I am trying to run a node.js app on heroku. I got it working local, but when i deploy it on heroku i get the following error:

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

This is the port i try to listen to:

const PORT = process.env.port || 3000;

When i logged what the process.env.port was it said process.env.port was undefined.

Is there anything i need to do to automatically set the port?

Edit (FIX): So i found out where the problem was. The javascript was being minified, but the process.env.port was minified to something that didn't work. Thanks for the help.

like image 549
Nylsoo Avatar asked Sep 06 '25 03:09

Nylsoo


1 Answers

for any one get to that post. first check if you are writing process.env.PORT correctly. I was writing .Port and it took 4 hours of my life to figure out the error

like image 121
med morad Avatar answered Sep 07 '25 23:09

med morad