Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read properties of undefined (reading 'OnUncaughtException') #127

Open
mehdibo opened this issue Jul 2, 2024 · 5 comments · May be fixed by #129
Open

Cannot read properties of undefined (reading 'OnUncaughtException') #127

mehdibo opened this issue Jul 2, 2024 · 5 comments · May be fixed by #129

Comments

@mehdibo
Copy link

mehdibo commented Jul 2, 2024

Version: @ntegral/nestjs-sentry: 4.0.1

Usage:

SentryModule.forRootAsync({
      useFactory: async (
        config: ConfigService,
      ): Promise<SentryModuleOptions> => {
        return {
          dsn: config.get('SENTRY_DSN'),
          debug: process.env.NODE_ENV !== 'production',
          environment: process.env.NODE_ENV,
          release: APP_VERSION,
          logLevels: ['error', 'warn'],
        };
      },
      inject: [ConfigService],
    })

I am currently getting this error (it was working fine):

[Nest] 12757 - 07/02/2024, 10:15:50 PM ERROR [ExceptionHandler] Cannot read properties of undefined (reading 'OnUncaughtException')
TypeError: Cannot read properties of undefined (reading 'OnUncaughtException')
at new SentryService (/sentry.service.ts:25:33)
at InstanceWrapper.useFactory [as metatype] (/sentry-core.module.ts:40:59)
at Injector.instantiateClass (/nestjs-api/node_modules/.pnpm/@nestjs+core@10.3.10_@nestjs+common@10.3.10_class-transformer@0.5.1_class-validator@0.14.1_re_mxy2umldb5kjaz5pxuunqqkrty/node_modules/@nestjs/core/injector/injector.js:368:55)
at callback (
/nestjs-api/node_modules/.pnpm/@nestjs+core@10.3.10_@nestjs+common@10.3.10_class-transformer@0.5.1_class-validator@0.14.1_re_mxy2umldb5kjaz5pxuunqqkrty/node_modules/@nestjs/core/injector/injector.js:65:45)
at Injector.resolveConstructorParams (/nestjs-api/node_modules/.pnpm/@nestjs+core@10.3.10_@nestjs+common@10.3.10_class-transformer@0.5.1_class-validator@0.14.1_re_mxy2umldb5kjaz5pxuunqqkrty/node_modules/@nestjs/core/injector/injector.js:144:24)
at Injector.loadInstance (
/nestjs-api/node_modules/.pnpm/@nestjs+core@10.3.10_@nestjs+common@10.3.10_class-transformer@0.5.1_class-validator@0.14.1_re_mxy2umldb5kjaz5pxuunqqkrty/node_modules/@nestjs/core/injector/injector.js:70:13)
at Injector.loadProvider (***/nestjs-api/node_modules/.pnpm/@nestjs+core@10.3.10_@nestjs+common@10.3.10_class-transformer@0.5.1_class-validator@0.14.1_re_mxy2umldb5kjaz5pxuunqqkrty/node_modules/@nestjs/core/injector/injector.js:97:9)
at /nestjs-api/node_modules/.pnpm/@nestjs+core@10.3.10_@nestjs+common@10.3.10_class-transformer@0.5.1_class-validator@0.14.1_re_mxy2umldb5kjaz5pxuunqqkrty/node_modules/@nestjs/core/injector/instance-loader.js:56:13
at async Promise.all (index 4)
at InstanceLoader.createInstancesOfProviders (
/nestjs-api/node_modules/.pnpm/@nestjs+core@10.3.10_@nestjs+common@10.3.10_class-transformer@0.5.1_class-validator@0.14.1_re_mxy2umldb5kjaz5pxuunqqkrty/node_modules/@nestjs/core/injector/instance-loader.js:55:9)

@pereslavtsev
Copy link

pereslavtsev commented Jul 3, 2024

the same problem (v4.0.1)
sentry node v7 works fine - https://www.npmjs.com/package/@sentry/node/v/7.118.0

@RafaPalau
Copy link

RafaPalau commented Jul 3, 2024

Good morning. I have the same problem. Wouldn't it be possible to use Sentry v8? It seems that the error in @ntegral/nestjs-sentry would be in this part of the code.
I think Integrations no longer exist in "@sentry/node" 8.13.0

2024-07-03_12-00

@LWJerri
Copy link

LWJerri commented Jul 6, 2024

I have the same issue on the latest version of @sentry/node, but everything is ok on @sentry/node@7.117.0.

@mehdibo
Copy link
Author

mehdibo commented Aug 21, 2024

I solved it by downgrading to @sentry/node to ^7.119.0

@CakeWithDivinity CakeWithDivinity linked a pull request Aug 22, 2024 that will close this issue
@CakeWithDivinity
Copy link

Yeah the plugin doesn't work with sentry v8.0. I opened a PR including the changes that should make it work again. I don't know how active this repository still is, since the last commit was 7 months ago.

Might be worth migrating to the official NestJS integration from Sentry: https://docs.sentry.io/platforms/javascript/guides/nestjs/ although it is still in alpha for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants