You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like sentry's async footwork plays poorly with pino-http. I've opened the issue here because I don't think pino-http is at fault, it's just using node's response events.
Steps to Reproduce
# 1. run
pnpm start
# 2. run
pnpm test
You'll observe that express does send the responses appropriately with the right errors - but, what's logged by Pino is entirely different.
Hi @theo-m, thanks for writing in and thanks for providing a reproduction!
I gave it a try and what I can see is that the error that's sent to Sentry is the "not happy" error you're throwing in your test route. This is what you'd expect, right? Likewise, this is the error that I get returned on the client side.
Now, pino logs the "failed with status code 500" error, but it does so regardless of if I remove all Sentry imports or leave them in place.
The only difference I notice is that there are a couple more stack frames from opentelemetry but this shouldn't be a problem. It's just expected behaviour from wrapping some node modules.
Can you clarify what's the expected behaviour/what exactly is going wrong?
I gave it a try and what I can see is that the error that's sent to Sentry is the "not happy" error you're throwing in your test route. This is what you'd expect, right? Likewise, this is the error that I get returned on the client side.
Yes indeed! My problem is what's logged by pino, which is confusing when reading server logs - and the heart of the problem.
Now, pino logs the "failed with status code 500" error, but it does so regardless of if I remove all Sentry imports or leave them in place.
The only difference I notice is that there are a couple more stack frames from opentelemetry but this shouldn't be a problem. It's just expected behaviour from wrapping some node modules.
You're right! I've tried a couple of ablations and permutations and got things mixed up, I'm observing the issue when removing Sentry still - my bad for opening a ticket on a Friday haha
Will close, sorry for the waste of time and thanks for looking at this 🙏
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.26.0
Framework Version
No response
Link to Sentry event
https://mra-30.sentry.io/issues/5747145444
Reproduction Example/SDK Setup
Here is reproduction repository: https://github.com/theo-m/repro-sentry-logging
It seems like sentry's async footwork plays poorly with pino-http. I've opened the issue here because I don't think pino-http is at fault, it's just using node's response events.
Steps to Reproduce
You'll observe that express does send the responses appropriately with the right errors - but, what's logged by Pino is entirely different.
Expected Result
see repo https://github.com/theo-m/repro-sentry-logging
Actual Result
see repo https://github.com/theo-m/repro-sentry-logging
The text was updated successfully, but these errors were encountered: