mentos1386 / nest-raven

Sentry Module for Nest.js Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can not make global config work

alfredvaa opened this issue · comments

import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AppGateway } from './app.gateway';
import { APP_INTERCEPTOR } from '@nestjs/core';
import { RavenModule, RavenInterceptor } from 'nest-raven';

@Module({
  imports: [
    TypeOrmModule.forRoot(),
    /* ... */
    RavenModule.forRoot('https://****'),
  ],
  controllers: [AppController],
  providers: [
    AppService,
    AppGateway,
    {
      provide: APP_INTERCEPTOR,
      useClass: RavenInterceptor(),
    },
  ],
  exports: [AppGateway],
})
export class AppModule {}

With this added, should most errors be reported to Sentry? I can not see any errors reported at all. Do I need to add anything more? I am using Nest version 5.1.0.

I tried to recreate the issue, but it works for me. Are you using version 2.1.0?

I'm having the same issue. Trying to investigate now.

Ok so I've followed this all the way through to raven and it's transport method. First I presumed this could of been a version mismatch where I ran yarn add nest-raven raven @types/raven So I corrected this as yarn added raven 2.6.2 in my root and 2.4.1 in nest-raven and moved @types/raven to dev so the dependancies don't clash.

I've found that the http transport request doesn't seem to get a response? Following through to the package raven: it's been achieved and recommends using the sentry JS SDK. So it could be possible that raven is no longer to be used? Although they use it for their installation instructions? I'll keep investigating and see if I can resolve this issue. If I can I will make a PR.

UPDATE:

Only thing I can seem to spot is sentry is rejecting my request? Don't think this is package related at all.

@bashleigh About deprecating raven, you are right, they are creating a mono repo and putting everything behind @sentry namespace. It's still in Beta and raven is still going to get bug fixes so i wouldn't move nest-raven to that yet.

Though we could make a beta version of nest-raven that will use @sentry/minimal for people that want to use that (could also include some new features with that release).

About the issue, easiest way to see if it's nest-raven issue or raven would be to edit this file raven.interceptor.abstract.ts#L32 and add some console.log(exception);. If you see exception in console, then issue would be in raven as all we do is passing exception to it. Else, you can try logging it before if filter and see if exception is even seen by the interceptor.

Only thing I can seem to spot is sentry is rejecting my request? Don't think this is package related at all.

What is the exception that you are throwing? Anything special that could cause issues?

@mentos1386 that'll be cool :) I'll give you a hand if you want?

I did quite a few console logs everywhere including within raven. It looks like sentry was rejecting the api call. Not entirely sure why however when running within a container it didn't work, running the same code on my local machine worked? So I'm presuming it must have something to do with the docker container?

The stranger thing is there's no exception :p however if you console log the response there's either no response callback called or the request is returned as 201 yet within sentry it says there's too many requests so it's not accepting it? If I find a better reason I'll let you know but I don't think it's got anything to do with your package :)

@bashleigh Hey sorry for late reply. I'm studying abroad for one semester and i don't think i'll have enough time to experiment with this too much. But i created a branch anyway nest-raven/next so if you want to help out you can create a PR to that branch :)

Im also going to close this issue as it doesn't seem to be an actual issue.

@bashleigh you can open a new one if you want to discuss about using @sentry/minimal and the future of this library.

I forgot to update you! Soon as I deployed this to kubernetes it worked!