Files
kevinveenbirkenbachandClaude Opus 5.5 a0c7023eab fix(web-app-n8n): log the SSO hook through n8n's own logger
The SSO hook reported its start, every sign-in, every created account and
every error through this.logger (#852). n8n 2 calls an external hook with
a context that holds only dbCollections, so this.logger is undefined and
the optional chaining turned every one of those calls into a no-op: after
an SSO sign-in that created an account, the container log held no line
about it.

The hook now resolves the Logger service from n8n's dependency container
(@n8n/di and @n8n/backend-common, loaded through n8n's own require like
the other modules the hook uses) and writes every message through it. The
requires moved to the top of the ready hook so the first message can use
the logger.

Verified on the pinned image docker.n8n.io/n8nio/n8n:2.44.0, started
with EXTERNAL_HOOK_FILES pointing at the hook and N8N_FORWARD_AUTH_HEADER
set: with this hook the log carries "SSO middleware initializing with
header: X-Forwarded-Email" and "SSO middleware initialized successfully"
before "Editor is now accessible via:"; with the hook of main the same
start reaches the editor without a single SSO line.

Closes #852

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 21:32:10 +02:00
..