I am trying to push my app to heroku bu I am getting this problem where I am using the correct port number using the process.env.PORT variable but still I am getting this error message:
heroku[web.1]: Starting process with command `node app.js`
app[web.1]: info - socket.io started
app[web.1]: Express server listening on port 49559 in development mode
heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 10843, should be 49559 (see environment variable PORT)
heroku[web.1]: Stopping process with SIGKILL
heroku[web.1]: Process exited
You can see in this error message that app is using the right port but still heroku shows the bad bind error. Any help is appreciated.