nest: TypeError: instance.getTimestamp is not a function

Bug Report

Ever since upgrading to 7.6, this error occurs forcing me to lock version to 7.5.5.

I am wanting to invoke my own custom logger and following documentation which references to setting logger to false when wanting to do so

Current behavior

This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason: [0] TypeError: instance.getTimestamp is not a function [0] at Function.printMessage (/…/node_modules/@nestjs/common/services/logger.service.js💯58) [0] at Function.log (/…/node_modules/@nestjs/common/services/logger.service.js:49:14) [0] at SentryLogger.log (/…/dist/server/src/logger/logger.service.js:49:25) [0] at Logger.callFunction (/…/node_modules/@nestjs/common/services/logger.service.js:82:18) [0] at Logger.log (/…/node_modules/@nestjs/common/services/logger.service.js:24:14) [0] at /…/node_modules/@nestjs/core/router/routes-resolver.js:37:25 [0] at Map.forEach (<anonymous>) [0] at RoutesResolver.registerRouters (/…/node_modules/@nestjs/core/router/routes-resolver.js:32:16) [0] at /…/node_modules/@nestjs/core/router/routes-resolver.js:28:18 [0] at Map.forEach (<anonymous>)

Input Code

  const app = await NestFactory.create(AppModule, {
    logger: false,
  })

  const configService = app.get(ConfigService)
  const sentryLogger = app.get(SentryLogger)

  app.enableCors()
  app.useLogger(app.get(SentryLogger))
  app.useGlobalFilters(new AllExceptionsFilter(sentryLogger))
  app.useGlobalPipes(new ValidationPipe())

Expected behavior

App loads successfully

Possible Solution

Environment


Nest version:7.6.5

 
For Tooling issues:
- Node version: v14.12.0
- Platform:  MAc

Others:

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Please, test with @nestjs/common@7.6.6