Open lukekluky opened 8 months ago
I've came to the same conclusion after wondering why Sentry errors don't include any request information (invoked URL, headers, etc.).
Sentry plugin must register the Sentry.Handlers.requestHandler
and Sentry.Handlers.tracingHandler()
middlewares before Payload registers its own handlers for /api route etc (potentially after /static
route).
As for error middlewares added by the plugin, that might need more consideration since I don't know for sure how Payload processes erros but Sentry error middleware should not send its own response but let Payload respond with proper error to the client.
Another problem with that is that errors like incorrect password or auto-logout due to timeout are reported to sentry, even though they are not supposed to (because those are not >=500 errors).
Link to reproduction
No response
Describe the Bug
We set a list of capture errors and pass it to the plugin, But it does not work as expected. Some error still sent to the Sentry although the error status is not in the list of
captureErrors
. After some investigation, we figured out that there's an incorrect order between payload and sentry on the error handling middleware. Sentry error middleware comes after payload error handling. This happening because plugin initiate after the payload. We manage to makes a temporary fix with recreate the plugin and add check on the hook.To Reproduce
captureErrors
Payload Version
2.11.2
Adapters and Plugins
plugin-sentry