Like, for example some kind of request ID that I could attach to my logs to group by request
Like, for example some kind of request ID that I could attach to my logs to group by request


createLogger(request) to access it)next-on-pages, but does Middleware have some way of passing data around?
⨯ Error: Cannot find module 'node:async_hooks'
createLogger(request) ⨯ Error: Cannot find module 'node:async_hooks'export function middleware(request: NextRequest) {
const rayId =
request.headers.get("CF-Ray") ??
Math.floor(Math.random() * 10000).toString();
return als.run(rayId, () => NextResponse.next());
}config.plugins.push(
new webpack.IgnorePlugin({
resourceRegExp: /^node:async_hooks$/,
}),
);