🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@travelerdev/nestjs-sentry-graphql

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travelerdev/nestjs-sentry-graphql

Provides an injectable sentry.io client to provide enterprise logging of nestjs modules with GraphQL

4.3.0
latest
Source
npm
Version published
Weekly downloads
1.9K
-34.75%
Maintainers
1
Weekly downloads
 
Created
Source

@travelerdev/nestjs-sentry-graphql

Provides an injectable sentry.io client to provide enterprise logging of nestjs modules using GraphQL

About

@travelerdev/nestjs-sentry-graphql is an extension of @travelerdev/nestjs-sentry, which is itself built upon the foundation developed by @ntegral/nestjs-sentry.

This package implements a module, SentryModule which when imported into your nestjs project provides a Sentry.io client to any class that injects it. This lets Sentry.io be worked into your dependency injection workflow without having to do any extra work outside of the initial setup.

It also implements a class, GraphqlInterceptor, which can intercept resolver errors into Sentry.

If you do not use graphql, you should consider using @travelerdev/nestjs-sentry instead to avoid unnecessary dependencies.

Getting Started

For details getting started instructions, see @travelerdev/nestjs-sentry

Quick Start

npm install --save @travelerdev/nestjs-sentry-graphql @nestjs/graphql

To get started with @travelerdev/nestjs-sentry-graphql you should add an import of SentryModule.forRoot to your app's root module.

import { Module } from '@nestjs-common';
import { SentryModule } from '@travelerdev/nestjs-sentry-graphql';

@Module({
  imports: [
    SentryModule.forRoot({
      dsn: '<< your sentry_io_dsn >>',
      debug: true | false,
      environment: 'dev' | 'production' | 'some_environment',
      release: 'some_release', | null, // must first create a release in sentry.io dashboard
      logLevels: ["debug"] //based on sentry.io loglevel //
    }),
  ],
})
export class AppModule {}

There are other instantiation methods documented in @travelerdev/nestjs-sentry's readme.

GraphQL Interceptor

The GraphqlInterceptor in this package can be used at the App level to intercept resolver errors and pass them up to Sentry.

Using graphql interceptor globally:

import { Module } from '@nestjs/common';
import { APP_INTERCEPTOR } from '@nestjs/core';
import { GraphqlInterceptor } from '@travelerdev/nestjs-sentry-graphql';

@Module({
  ....
  providers: [
    {
      provide: APP_INTERCEPTOR,
      useFactory: () => new GraphqlInterceptor(),
    },
  ],
})
export class AppModule {}

Keywords

nestjs

FAQs

Package last updated on 14 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts