NestJs startup delay

Viewed 683

I'm having a decent NestJs project. I'm using the Graphql CLI plugin and Prisma as ORM.

No matter how I start the project (start:dev, start, start:prod), there is a delay after loading all the modules and registering all the routes:

[Nest] 29996   - 20.02.2021, 13:41:03   [NestFactory] Starting Nest application...
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] DiscoveryModule dependencies initialized +331ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] ConfigHostModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] AppModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] ServeStaticModule dependencies initialized +2ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] ConfigModule dependencies initialized +2ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] ScheduleModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] ConfigModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +2ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +2ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] GraphQLSchemaBuilderModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +3ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] xxxModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:03   [InstanceLoader] GraphQLModule dependencies initialized +1ms
[Nest] 29996   - 20.02.2021, 13:41:04   [RoutesResolver] AppController {}: +584ms
[Nest] 29996   - 20.02.2021, 13:41:04   [RouterExplorer] Mapped {, GET} route +5ms
[Nest] 29996   - 20.02.2021, 13:41:04   [RoutesResolver] xxxController {/xxx}: +1ms
[Nest] 29996   - 20.02.2021, 13:41:04   [RouterExplorer] Mapped {/xxx, POST} route +2ms
...
[Nest] 29996   - 20.02.2021, 13:41:04   [RouterExplorer] Mapped {/xxx/:id, DELETE} route +1ms
[Nest] 29996   - 20.02.2021, 13:41:28   [NestApplication] Nest application successfully started +23721ms

Here it was ~24s before Nest announces that it has successfully started. This delay does not happen on other NestJs projects I have seen.

Is it supposed to be like this? Any idea, where/how to further analyze what Nest is doing in these 20-30s?

0 Answers
Related