For Strapi v4:
For Strapi v3:
In config/middleware.js
module.exports = {
settings: {
sentry: {
enabled: true,
},
},
};
middlewares/sentry/index.js
Sentry.init({...params})
module.exports = (strapi) => {
return {
initialize() {
strapi.app.use(async (ctx, next) => {
try {
await next();
} catch (error) {
Sentry.captureException(error);
throw error;
}
});
},
};
};