File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,8 +15,9 @@ import {
1515import { ApolloDriver , ApolloDriverConfig } from '@nestjs/apollo' ;
1616import { Module } from '@nestjs/common' ;
1717import { ConfigModule , ConfigService } from '@nestjs/config' ;
18- import { APP_GUARD } from '@nestjs/core' ;
18+ import { APP_FILTER , APP_GUARD } from '@nestjs/core' ;
1919import { GraphQLModule } from '@nestjs/graphql' ;
20+ import { SentryGlobalFilter , SentryModule } from '@sentry/nestjs/setup' ;
2021
2122import { UserGroupGuard } from './auth/user-group-header.guard' ;
2223import { BackendModule } from './backend/backend.module' ;
@@ -32,6 +33,7 @@ const version = getVersionInfo(__dirname);
3233
3334@Module ( {
3435 imports : [
36+ SentryModule . forRoot ( ) ,
3537 ConfigModule . forRoot ( {
3638 load : [ ( ) : AppConfig => Config . getProperties ( ) ] ,
3739 isGlobal : true ,
@@ -70,6 +72,10 @@ const version = getVersionInfo(__dirname);
7072 ] ,
7173 controllers : [ ] ,
7274 providers : [
75+ {
76+ provide : APP_FILTER ,
77+ useClass : SentryGlobalFilter ,
78+ } ,
7379 MetricsFactory ,
7480 {
7581 provide : APP_GUARD ,
Original file line number Diff line number Diff line change 77import './monitoring' ;
88
99import { NestApplicationOptions } from '@nestjs/common' ;
10- import { HttpAdapterHost , NestFactory } from '@nestjs/core' ;
10+ import { NestFactory } from '@nestjs/core' ;
1111import { NestExpressApplication } from '@nestjs/platform-express' ;
1212import { allowlistGqlQueries } from 'fxa-shared/nestjs/gql/gql-allowlist' ;
1313import helmet from 'helmet' ;
1414import cors from 'cors' ;
1515import * as Sentry from '@sentry/nestjs' ;
16- import { SentryGlobalFilter } from '@sentry/nestjs/setup' ;
1716
1817import { AppModule } from './app.module' ;
1918import Config , { AppConfig } from './config' ;
@@ -30,10 +29,6 @@ async function bootstrap() {
3029 nestConfig
3130 ) ;
3231
33- // Register Sentry exception filter with proper HttpAdapterHost
34- const { httpAdapter } = app . get ( HttpAdapterHost ) ;
35- app . useGlobalFilters ( new SentryGlobalFilter ( httpAdapter ) ) ;
36-
3732 app . use (
3833 cors ( {
3934 origin : appConfig . cors . origin ,
Original file line number Diff line number Diff line change 22 * License, v. 2.0. If a copy of the MPL was not distributed with this
33 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44import { Module } from '@nestjs/common' ;
5+ import { APP_FILTER } from '@nestjs/core' ;
56import { ConfigModule } from '@nestjs/config' ;
67import { ScheduleModule } from '@nestjs/schedule' ;
8+ import { SentryGlobalFilter , SentryModule } from '@sentry/nestjs/setup' ;
79import { HealthModule } from 'fxa-shared/nestjs/health/health.module' ;
810import { LoggerModule } from 'fxa-shared/nestjs/logger/logger.module' ;
911import { MetricsFactory } from 'fxa-shared/nestjs/metrics.service' ;
@@ -22,6 +24,7 @@ const version = getVersionInfo(__dirname);
2224
2325@Module ( {
2426 imports : [
27+ SentryModule . forRoot ( ) ,
2528 AuthModule ,
2629 ClientCapabilityModule ,
2730 ClientWebhooksModule ,
@@ -38,6 +41,12 @@ const version = getVersionInfo(__dirname);
3841 PubsubProxyModule ,
3942 ] ,
4043 controllers : [ ] ,
41- providers : [ MetricsFactory ] ,
44+ providers : [
45+ {
46+ provide : APP_FILTER ,
47+ useClass : SentryGlobalFilter ,
48+ } ,
49+ MetricsFactory ,
50+ ] ,
4251} )
4352export class AppModule { }
Original file line number Diff line number Diff line change 77import './monitoring' ;
88
99import * as Sentry from '@sentry/nestjs' ;
10- import { SentryGlobalFilter } from '@sentry/nestjs/setup' ;
1110
1211import { NestApplicationOptions } from '@nestjs/common' ;
1312import { ConfigService } from '@nestjs/config' ;
14- import { HttpAdapterHost , NestFactory } from '@nestjs/core' ;
13+ import { NestFactory } from '@nestjs/core' ;
1514import mozLog from 'mozlog' ;
1615
1716import { initTracing } from 'fxa-shared/tracing/node-tracing' ;
@@ -34,10 +33,6 @@ async function bootstrap() {
3433 const config : ConfigService < AppConfig > = app . get ( ConfigService ) ;
3534 const proxyConfig = config . get ( 'proxy' ) as AppConfig [ 'proxy' ] ;
3635
37- // Register Sentry exception filter with proper HttpAdapterHost
38- const { httpAdapter } = app . get ( HttpAdapterHost ) ;
39- app . useGlobalFilters ( new SentryGlobalFilter ( httpAdapter ) ) ;
40-
4136 // Starts listening for shutdown hooks
4237 app . enableShutdownHooks ( ) ;
4338
You can’t perform that action at this time.
0 commit comments