When I was trying to deploy my NestJS app to Heroku I was seeing the error Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
Why does setting the url to 0.0.0.0
make it work?
const port = process.env.PORT || 5000;
await app.listen(port, '0.0.0.0');
Context:
- When I deploy without
0.0.0.0
my app saysListening at http://127.0.0.1:<randomNumber>
- When I deploy with
0.0.0.0
my app saysListening at http://127.0.0.1:<randomNumber>
- Node version: 16.13.0
- NestJS
- Middleware: Fastify
- Set
NPM_CONFIG_PROD=false
- No cors
- No helmet
"@nestjs/common": "^8.0.0",
"@nestjs/core": "^8.0.0",
"@nestjs/platform-fastify": "^8.0.11",