fix(lambda): uppercase LOG_LEVEL in the shared lambda module - #5303
Open
zxkane wants to merge 1 commit into
Open
fix(lambda): uppercase LOG_LEVEL in the shared lambda module#5303zxkane wants to merge 1 commit into
zxkane wants to merge 1 commit into
Conversation
github-aws-runners#5238 wrapped every LOG_LEVEL assignment with upper() so that Powertools v2 stops silently discarding the value, but it missed modules/lambda/main.tf. That module builds the environment for four functions: runners/job-retry, termination-watcher/deregister-retry, termination-watcher/notification and termination-watcher/termination. The variable is validated against lowercase names only ("debug", "info", "warn", "error"), so the value reaching those four functions can never match Powertools' uppercase LogLevelThreshold keys. Every level silently resolves to INFO. Requesting "debug" yields no debug output, and requesting "warn" or "error" yields more output than asked for. POWERTOOLS_LOGGER_LOG_EVENT keeps comparing the raw lowercase variable, which is still correct. Signed-off-by: Kane Zhu <843303+zxkane@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
#5238 wrapped every
LOG_LEVELassignment withupper()so Powertools v2 stops silently discarding the value, but it missedmodules/lambda/main.tf. That module builds the environment for four functions:modules/runners/job-retrymodules/termination-watcher/deregister-retrymodules/termination-watcher/notificationmodules/termination-watcher/terminationvar.lambda.log_levelis validated against lowercase names only (debug,info,warn,error), so the value reaching those four functions can never match Powertools' uppercaseLogLevelThresholdkeys — every level silently resolves toINFO. Asking fordebugproduces no debug output, and asking forwarnorerrorproduces more output than requested.POWERTOOLS_LOGGER_LOG_EVENTstill compares the raw lowercase variable, which remains correct, so it is left untouched.Test Plan
Reproduced against the
@aws-lambda-powertools/loggerversion this repository already depends on:LOG_LEVELdebugINFODEBUGDEBUGwarnINFOWARNWARNConfirmed on a live deployment before this change: the functions created through
modules/lambdahadLOG_LEVEL=info, while every function fixed by #5238 hadLOG_LEVEL=INFO.Checks run locally:
terraform fmt -recursive -check=true -write=falseterraform validateonmodules/lambda,modules/runners/job-retry,modules/termination-watcher,modules/termination-watcher/notificationandmodules/termination-watcher/terminationLOG_LEVELassignment remains anywhere undermodules/Applying this to a running deployment is an in-place Lambda environment update — no resource replacement.
Related Issues
Follow-up to #5238.