Closed
Description
- @sentry/nextjs 6.11.0
- Running Next.js as a regular node server (eg not Vercel lambdas)
Our infra pings our Next.js API Route GET /api/healthz
before each deployment goes live.
For some reason, every event after this shows up in Sentry associated with this transaction.
It looks like domains were supposed to prevent this from happening (#3788 and #3574) but we're seeing it consistently.
Possibly related, to keep our files DRY we define our withSentry (amongst other things like auth etc) in a file that is imported and used by each API Route:
// shared/route.js
import { withSentry } from '@sentry/nextjs'
export function route(req, res) {
return withSentry(async (req, res) => {
// perform auth, log ip etc
})
}
// api/foobars.js
import { route } from 'shared/route'
export default route(req, res) {
res.status(200).send('Foobars')
}
Our code definitely returns a new instance of withSentry() but I wonder if domains are not able to clearly differentiate?