Skip to content

Commit 1f29dad

Browse files
committed
fix: safer res.locals access on logging
1 parent f27ea8a commit 1f29dad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/telemetry/requestLogger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function finishLog<SLocals extends AnyServiceLocals = ServiceLocals<Configuratio
6666
}
6767

6868
const prefs = (res.locals as WithLogPrefs)[LOG_PREFS];
69-
if (prefs.logged) {
69+
if (prefs?.logged) {
7070
// This happens when error handler runs, but onEnd hasn't fired yet. We only log the first one.
7171
return;
7272
}

0 commit comments

Comments
 (0)