mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat(api): swap to immobiliarelabs sentry plugin (#50041)
This commit is contained in:
+1
-1
@@ -9,8 +9,8 @@
|
||||
"@fastify/session": "^10.1.1",
|
||||
"@fastify/swagger": "^8.3.1",
|
||||
"@fastify/swagger-ui": "^1.5.0",
|
||||
"@immobiliarelabs/fastify-sentry": "^5.0.2",
|
||||
"@prisma/client": "4.12.0",
|
||||
"@sentry/node": "7.48.0",
|
||||
"connect-mongo": "4.6.0",
|
||||
"fastify": "4.15.0",
|
||||
"fastify-auth0-verify": "^1.0.0",
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
import { init, captureException } from '@sentry/node';
|
||||
import Sentry, { SentryPluginOptions } from '@immobiliarelabs/fastify-sentry';
|
||||
import { FastifyPluginCallback } from 'fastify';
|
||||
import fp from 'fastify-plugin';
|
||||
|
||||
const fastifySentry: FastifyPluginCallback<{ dsn: string }> = (
|
||||
const fastifySentry: FastifyPluginCallback<SentryPluginOptions> = async (
|
||||
fastify,
|
||||
options,
|
||||
done
|
||||
options
|
||||
) => {
|
||||
init(options);
|
||||
await fastify.register(Sentry, options);
|
||||
|
||||
fastify.setErrorHandler((error, request) => {
|
||||
captureException(error);
|
||||
request.log.error(error);
|
||||
});
|
||||
done();
|
||||
fastify.log.info('Sentry plugin registered');
|
||||
};
|
||||
|
||||
export default fp(fastifySentry);
|
||||
|
||||
Reference in New Issue
Block a user