Giter Site home page Giter Site logo

nestjs-sentry-example's People

Contributors

hardydex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nestjs-sentry-example's Issues

Module '"../../../@nestjs/common"' has no exported member 'ConsoleLoggerOptions'

Hello,

I was trying to use this package to connect to sentry but I'm having this error.

node_modules/@ntegral/nestjs-sentry/dist/sentry.interfaces.d.ts:4:10 - error TS2305: Module '"../../../@nestjs/common"' has no exported member 'ConsoleLoggerOptions'.

4 import { ConsoleLoggerOptions } from "@nestjs/common";
           ~~~~~~~~~~~~~~~~~~~~

node_modules/@ntegral/nestjs-sentry/dist/sentry.service.d.ts:1:10 - error TS2305: Module '"../../../@nestjs/common"' has no exported member 'ConsoleLogger'.

1 import { ConsoleLogger } from '@nestjs/common';

Im using the following versions on package.json

"@ntegral/nestjs-sentry": "^3.0.3",
 "@nestjs/common": "^7.6.18",
 "@nestjs/config": "^0.6.3",
 "@nestjs/core": "^7.6.18",

Am I missing something?

thrown errors aren't being reported

If I rewrite app.controller.ts into

import { Controller, Get } from '@nestjs/common';
import { InjectSentry, SentryService } from '@ntegral/nestjs-sentry';
import { AppService } from './app.service';

@Controller()
export class AppController {
  constructor(
    @InjectSentry() private readonly client: SentryService,
    private readonly appService: AppService,
  ) {}

  @Get()
  getHello(): string {
    this.client.error('error reported via this.client.error') // <-- this is being reported to Sentry
    throw Error('thrown error from the example');            // <-- this is not being reported to Sentry
    return this.appService.getHello();
  }
}

I don't see unexpected errors (emulated here by throw Error()) reported to Sentry. Is this intentional? How am I supposed to hook up the library to have those errors reported?

`npm test` fails

Hi,

thanks for the example. I do get the errors reported to Sentry (after replacing the DSN, of course), but npm test unfortunately fails:

 FAIL  src/app.controller.spec.ts
  AppController
    root
      ✕ should return "Hello World!" (5 ms)

  ● AppController › root › should return "Hello World!"

    Nest can't resolve dependencies of the AppController (?, AppService). Please make sure that the argument SentryToken at index [0] is available in the RootTestModule context.

    Potential solutions:
    - If SentryToken is a provider, is it part of the current RootTestModule?
    - If SentryToken is exported from a separate @Module, is that module imported within RootTestModule?
      @Module({
        imports: [ /* the Module containing SentryToken */ ]
      })

      at Injector.lookupComponentInParentModules (../node_modules/@nestjs/core/injector/injector.js:188:19)
      at Injector.resolveComponentInstance (../node_modules/@nestjs/core/injector/injector.js:144:33)
      at resolveParam (../node_modules/@nestjs/core/injector/injector.js:98:38)
          at async Promise.all (index 0)
      at Injector.resolveConstructorParams (../node_modules/@nestjs/core/injector/injector.js:113:27)
      at Injector.loadInstance (../node_modules/@nestjs/core/injector/injector.js:46:9)
      at Injector.loadController (../node_modules/@nestjs/core/injector/injector.js:59:9)
          at async Promise.all (index 0)
      at InstanceLoader.createInstancesOfControllers (../node_modules/@nestjs/core/injector/instance-loader.js:52:9)

  ● AppController › root › should return "Hello World!"

    TypeError: Cannot read properties of undefined (reading 'getHello')

      17 |   describe('root', () => {
      18 |     it('should return "Hello World!"', () => {
    > 19 |       expect(appController.getHello()).toBe('Hello World!');
         |                            ^
      20 |     });
      21 |   });
      22 | });

      at Object.<anonymous> (app.controller.spec.ts:19:28)

Test Suites: 1 failed, 1 total

For sake of completeness: npm run test:e2e does pass.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.