←back to thread

Next.js is infuriating

(blog.meca.sh)
1033 points Bogdanp | 1 comments | | HN request time: 0.205s | source
Show context
quadhome ◴[] No.45101055[source]
AsyncLocalStorage.enterWith is the wrong method; .enterWith changes the logger for across the *synchronous* execution. This doesn't matter if there's only one request happening at time-- like when you're testing locally. But that's why it didn't work on the actual project.

Use .run.

  return LoggerStorage.run(requestLogger(), () => {
      logger()?.debug({ url: request.url }, "Started processing request!");
      return NextResponse.next();
  });
replies(3): >>45101118 #>>45108197 #>>45108244 #
1. ◴[] No.45108197[source]