Skip to content

Fix: set NODE_ENV in Lambda environment to match deploy stage - #1501

Open
jboolean wants to merge 1 commit into
masterfrom
fix/lambda-prod-node-env
Open

jboolean wants to merge 1 commit into
masterfrom
fix/lambda-prod-node-env

Conversation

@jboolean

Copy link
Copy Markdown
Owner

What

createConnection.ts only skips the dev-only validateEntityMetadata()
check when NODE_ENV === 'production', but provider.environment
never set NODE_ENV — only STAGE. Every deployed Lambda, including
production, ran this check on every invocation.

Fix

Add NODE_ENV: ${sls:stage} to provider.environment.

Context

renderMerchPrintfiles alone logs this noise ~288 times/day (its
5-minute schedule) — 5 ERROR-level lines per call for entities
unrelated to that lambda. This likely dominates any ERROR-level
log-volume alerting and buried the one real failure during the
2026-09-14 incident investigation.

🤖 Generated with Claude Code

createConnection.ts only skips the dev-only validateEntityMetadata()
check when NODE_ENV === 'production', but provider.environment never
set NODE_ENV - only STAGE. So every deployed Lambda (including prod)
ran that check on every invocation, logging 5 console.error lines per
call regardless of whether anything was actually wrong.

Seen in prod: renderMerchPrintfiles alone logged this noise ~288
times/day (its 5-minute schedule), which likely dominates any
ERROR-level log-volume alerting and buried the one real failure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant