NestJS Swagger Error this.getVersionMetadata(metatype, applicationConfig.getVersioning()); applicationConfig.getVersioning is not a function

Viewed 154

I have reinstalled @nestjs/swagger and swagger-ui-express. All my dependencies are up to date. But I get this error:

applicationConfig.getVersioning is not a function at SwaggerExplorer.exploreRoutePathAndMethod

I have updated metadata tags in tsconfig.ts file as well. After debugging, I can find that the main issue is at line where createDocument function is called from Swagger Module class. Every code line before that works fine.

On console logging, I even could extract the values of config-correctly. However, once the createDocument method is called, the API comes to a crashing halt with the above stated error.

My main.ts file looks like:

import { NestFactory } from '@nestjs/core';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  const config = new DocumentBuilder()
      .setTitle('Invoice Manager API')
      .setDescription('API for Invoice Manager App')
      .setVersion('0.0')
      .addTag('iv-manager')
      .build();
  const document = SwaggerModule.createDocument(app, config);
  SwaggerModule.setup('/', app, document);
  await app.listen(3000);

}

bootstrap();
0 Answers
Related