New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphQL plug-in prevents Sentry middleware from catching errors #10354
Comments
FWIW, I think this issue represents a broader problem in the design of the middlewares-in-plugins queuing system rather than a bug in the Sentry plug-in. |
Agreed, we are discussing it internally but we should summarize that discussion here @remidej |
@jorisw I am facing exactly this problem. Did you find some workaround? My best temporal solution by now is wrapping my controllers with a try/catch and manually send the error to Sentry but it's too much extra code... |
@IvanCoronado Indeed that's what we're doing. @derrickmehaffy Any updates on this? |
@alexandrebodin any idea how we can solve this as the Sentry plugin is worthless when using Strapi with Graphql? thanks |
@remidej is currently out of the office for a while, let me poke the team and see if it's going to be reassigned to someone else. |
@derrickmehaffy any update on this one? |
@remidej any information you can offer here? |
Not yet sorry 😕 |
@remidej when do you think you will have time to look into it? |
This issue has been mentioned on Strapi Community Forum. There might be relevant details there: https://forum.strapi.io/t/how-can-i-persist-logging-beyond-application-running-scope/8595/3 |
@derrickmehaffy in current Strapi version 3.6.x Sentry plugin is unusable... Is anyone from the core team looking into it? thanks |
We were able to get rid of try/catch blocks all over the controllers, by adding the following to There may be a better place to put this than in module.exports = {
apolloServer: {
plugins: [
{
requestDidStart() {
return {
didEncounterErrors(apolloContext) {
const koaContext = apolloContext.context.context
apolloContext.errors.forEach(error => {
strapi.log.error(error)
strapi.sentry.captureRequestError(error, koaContext)
})
},
}
},
},
],
},
} Perhaps the Strapi team could use such an approach to fix their Sentry plug-in. |
Fixed in v4 |
Bug report
Describe the bug
Because the Sentry plug-in's middleware comes after that of the GraphQL plug-in, and the GraphQL plug-in catches fatal errors for reporting in the response, fatal errors as part of GraphQL operations are not reported to Sentry.
Other middlewares are likely to suffer from the GraphQL plug-in catching the errors, too.
Steps to reproduce the behavior
sendError()
call somewhere and trigger the callhi()
Expected behavior
I expect fatal errors to be both reported by the GraphQL response, as well as reported by the Sentry plug-in to Sentry
Screenshots
These console logs, added to
node_modules/strapi-sentry-plugin/middlewares/sentry/index.js
, are not logged when calling a GraphQL query that triggers an error:I also tried to put the Sentry middleware before that of GraphQL, to no avail, probably because we're talking about middlewares as part of plug-ins:
System
The text was updated successfully, but these errors were encountered: