From 7e7655929884fcd67ad825d18a20172184cf9a2b Mon Sep 17 00:00:00 2001 From: Spencer Spenst Date: Thu, 21 Mar 2024 21:49:16 -0700 Subject: [PATCH] attempt 2 --- lib/withAuth.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/withAuth.ts b/lib/withAuth.ts index 28af9ba7b..d690e7782 100644 --- a/lib/withAuth.ts +++ b/lib/withAuth.ts @@ -50,6 +50,7 @@ export async function getUserFromToken( if (!isLocal()) { newrelic?.addCustomAttribute && newrelic.addCustomAttribute('userId', userId); + newrelic?.addCustomAttribute && newrelic.addCustomAttribute('logBody', JSON.stringify(req?.body)); } await dbConnect(); @@ -109,13 +110,6 @@ 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) {