ports on heroku
See original GitHub issueHey, great kit. Really blows the rest of them out of the water.
I’m attempting to run on heroku. I’ve given up trying to get heroku to do a npm run build
and am just building locally and pushing dist.
Here’s my question. Heroku sets the port dynamically for web processes through process.env.PORT
so i added it in kit/lib/env.js
const defaultPorts = {
production: {
server: process.env.PORT,
},
development: {
browser: 8080,
server: 8081,
},
};
heroku gives me this error, with the same 4000 port. nothing changed. any ideas?
what am I doing wrong? thanks in advance.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Setting the port for node.js server on Heroku - Stack Overflow
You can use any port number (in fact you can choose up to 65,535 port number) but once you want to deploy to...
Read more >Setting the HTTP Port for Java Applications | Heroku Dev Center
Heroku expects a web application to bind its HTTP server to the port defined by the $PORT environment variable. Many frameworks default to ......
Read more >Runtime Principles | Heroku Dev Center
Each web process simply binds to a port, and listens for requests ... The port to bind to is assigned by Heroku as...
Read more >Why is my Node.js app crashing with an R10 error?
1.) Using process.env.PORT ... Most Node.js apps bind to a specific port by default. For example, Express uses the following: app.listen(3000, function ()...
Read more >Deploying Node.js Apps on Heroku
The command in a web process type must bind to the port number specified in the PORT environment variable. If it does not,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Kamill90 Don’t worry about your local dist folder. One way to deploy your app to Heroku is to push your code to Heroku through git. Heroku will build and deploy it. Here’s how to set things up: https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction
FYI, I used Heroku’s container registry and runtime to deploy, no port config needed: