feat(api): swap to immobiliarelabs sentry plugin (#50041)

This commit is contained in:
Muhammed Mustafa
2023-04-17 22:10:23 +02:00
committed by GitHub
parent b6b5efca53
commit daa23a3d83
3 changed files with 63 additions and 56 deletions
+1 -1
View File
@@ -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",
+5 -10
View File
@@ -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);