I’m using the “@sentry/node” (v4.5.3) library in my node project. I don’t see any clear way to pass in my express request object in the same way that it was done with the Raven client. It’s very clearly documented in the Raven docs: Usage | Sentry Documentation but if I try the same thing with the @sentry/node client, I don’t get request info in errors.
How are requests properly logged in the Node unified SDK client?
I eventually found the Express integration page: https://docs.sentry.io/platforms/node/express/ and I was able to add the following as the first piece of middleware on my express app:
app.use(Sentry.Handlers.requestHandler());
Also, I’m running on AWS lambda, so I’m using my own error handle to call Sentry.captureException(err)
with an additional await Sentry.getCurrentHub().getClient().close(2000);
instead of using Sentry.Handlers.errorHandler()
.
I think it would be helpful if the main “Unified Browser JavaScript SDK” page referenced these integrations (e.g., Express) in some way. I did a cmd+f on that page for “express” and nothing came up.