chore(lambda): ephemeral storage validation error shows [object Object] - #38622
Open
badmintoncryer wants to merge 1 commit into
Open
chore(lambda): ephemeral storage validation error shows [object Object]#38622badmintoncryer wants to merge 1 commit into
badmintoncryer wants to merge 1 commit into
Conversation
aws-cdk-automation
previously requested changes
Aug 21, 2026
aws-cdk-automation
dismissed
their stale review
August 21, 2026 14:21
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
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.
Issue # (if applicable)
Closes #38621.
Reason for this change
When
ephemeralStorageSizeis out of the allowed range, the validation error interpolates theSizeobject straight into the message.Sizehas notoString(), so the value renders as[object Object]and users cannot tell which value they actually passed:Reproduction:
Description of changes
aws-lambda/lib/function.tsnow calls.toMebibytes()on the size when building the message and states the unit explicitly, so the error reads:Notes on why this is safe:
.toMebibytes()on the very same value, so this adds no new conversion failure path — aSizethat cannot be converted into whole mebibytes already throws before reaching this line.!props.ephemeralStorageSize.isUnresolved().Alternative considered and not taken here: adding
toString()toSizeincore(Durationalready has one, soSizeis the odd one out). That would address this class of problem globally, but it adds public API to core and deserves its own discussion. As far as I could find, this is the only place inaws-cdk-libtoday where aSize-typed value is interpolated into a message, so a local fix is sufficient for this bug.Describe any new or updated permissions being added
None.
Description of how you validated changes
Unit tests in
aws-lambda/test/function.test.ts:throws if ephemeral storage size is out of boundcase to assert the reported value (received 511 MiB) rather than only the prefix.Size.gibibytes(11)to confirm the size is reported normalized to MiB (received 11264 MiB).Both cases fail on
mainwithreceived [object Object].and pass with this change.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license