D
D
Daksin2022-02-02 19:22:45
Heroku
Daksin, 2022-02-02 19:22:45

How to fix error when deploying nest.js on heroku?

I'm trying to upload a nest.js application to heroku, here's the error:
61faafaee36bd468243976.png

main.ts:

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.setGlobalPrefix('api');
  await app.listen(5000, '0.0.0.0');
}
bootstrap();


I hope for your help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WapSter, 2022-02-02
@wapster92

heroku defaults to port 80 or 443 and you are trying to start on 5000.

await app.listen(process.env.PORT || 80, '0.0.0.0');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question