Skip to content

Commit

Permalink
disable newrelic when in test
Browse files Browse the repository at this point in the history
  • Loading branch information
k2xl committed Dec 9, 2023
1 parent 31d1ffa commit 6bb8219
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/withAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export async function getUserFromToken(
const decoded = verifiedSignature;
const userId = decoded.userId as string;
// dynamically import newrelic
const newrelic = await import('newrelic');
const newrelic = process.env.NODE_ENV === 'test' ? undefined : await import('newrelic');

if (!isLocal()) {
newrelic.addCustomAttribute && newrelic.addCustomAttribute('userId', userId);
newrelic?.addCustomAttribute && newrelic.addCustomAttribute('userId', userId);
}

await dbConnect();
Expand Down

0 comments on commit 6bb8219

Please sign in to comment.