We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
requestId
1 parent 3125fcf commit 5795151Copy full SHA for 5795151
1 file changed
packages/evlog/src/nitro/plugin.ts
@@ -147,11 +147,17 @@ export default defineNitroPlugin((nitroApp) => {
147
148
// Store start time for duration calculation in tail sampling
149
e.context._evlogStartTime = Date.now()
150
+
151
+ let requestIdOverride: string | undefined = undefined
152
+ if (globalThis.navigator?.userAgent === 'Cloudflare-Workers') {
153
+ const cfRay = getSafeHeaders(event)?.['cf-ray']
154
+ if (cfRay) requestIdOverride = cfRay
155
+ }
156
157
const log = createRequestLogger({
158
method: e.method,
159
path: e.path,
- requestId: e.context.requestId || crypto.randomUUID(),
160
+ requestId: requestIdOverride || e.context.requestId || crypto.randomUUID(),
161
})
162
163
// Apply route-based service configuration if a matching route is found
0 commit comments