diff --git a/lib/withAuth.ts b/lib/withAuth.ts index 434df1bdc..28af9ba7b 100644 --- a/lib/withAuth.ts +++ b/lib/withAuth.ts @@ -109,6 +109,13 @@ export default function withAuth( } try { + // dynamically import newrelic + const newrelic = process.env.NODE_ENV === 'test' ? undefined : await import('newrelic'); + + if (!isLocal()) { + newrelic?.addCustomAttribute && newrelic.addCustomAttribute('request.body', req.body); + } + const reqUser = await getUserFromToken(token, req); if (reqUser === null) {