Skip to content

Commit

Permalink
#99 Fix sentry v8 breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielemery committed Jul 6, 2024
1 parent 5989db5 commit 4c9946d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
3 changes: 2 additions & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
generator client {
provider = "prisma-client-js"
provider = "prisma-client-js"
previewFeatures = ["tracing"]
}

datasource db {
Expand Down
20 changes: 2 additions & 18 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './instrument';
import { ApolloServer } from '@apollo/server';
import { expressMiddleware } from '@apollo/server/express4';
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer';
Expand Down Expand Up @@ -78,25 +79,9 @@ async function initialise() {
},
});

Sentry.init({
dsn: config.SENTRY_DSN,
integrations: [
new Sentry.Integrations.Http({ tracing: true }),
new Sentry.Integrations.Express({ app }),
new Sentry.Integrations.Postgres(),
new Sentry.Integrations.Prisma({ client: prismaService.client() }),
new Sentry.Integrations.Apollo(),
],
tracesSampleRate: 1.0,
profilesSampleRate: 1.0,
environment: config.DOPPLER_CONFIG,
release: config.QUIZLORD_VERSION,
});

await server.start();

app.use(Sentry.Handlers.requestHandler());
app.use(Sentry.Handlers.tracingHandler());
Sentry.setupExpressErrorHandler(app);

app.use(
'/',
Expand Down Expand Up @@ -139,7 +124,6 @@ async function initialise() {
},
}),
);
app.use(Sentry.Handlers.errorHandler());

queueService.subscribeToFileUploads();
await new Promise<void>((resolve) => httpServer.listen({ port: 4000 }, resolve));
Expand Down
10 changes: 10 additions & 0 deletions src/instrument.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as Sentry from '@sentry/node';
import config from './config/config';
Sentry.init({
dsn: config.SENTRY_DSN,
integrations: [Sentry.prismaIntegration()],
tracesSampleRate: 1.0,
profilesSampleRate: 1.0,
environment: config.DOPPLER_CONFIG,
release: config.QUIZLORD_VERSION,
});

0 comments on commit 4c9946d

Please sign in to comment.