You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
logger: false silently disables every plugin onResponse hook (access-log hook throws on the null logger) #598
On a server booted with logger: false, core's access-log onResponse hook calls request.log.isLevelEnabled('info'). Fastify's null logger has no isLevelEnabled, so the hook throws on every request, and the aborted hook chain means all downstream pluginonResponse hooks never run. Earlier lifecycle stages (onRequest, preHandler, onSend) are unaffected, which makes the failure look like a plugin bug rather than a host one.
Repro
constfastify=createServer({logger: false,plugins: [{id: 'm',module: 'metrics/plugin.js',prefix: '/metrics'}]});// plugin's addHook('onResponse', ...) never fires; its request counters stay at zero
Workaround: boot with logger: true, logLevel: 'silent'.
One-line guard in the access-log hook: check typeof request.log.isLevelEnabled === 'function' (or wrap in try/catch, or skip the hook entirely when the logger is disabled).
Activity