Conversation
…Object] The out-of-range error interpolated the Size object directly into the message. Size has no toString(), so the value rendered as [object Object] and gave no indication of what was actually passed. Convert to mebibytes in the message, matching the conversion already performed by the range check on the line above. Fixes aws#38621
The linter requires an integration test file and snapshot when fixing validation error messages. This test exercises a valid ephemeral storage size to ensure the out-of-range check passes after the error message fix.
The Size class is exported from aws-cdk-lib (via core), not from aws-cdk-lib/aws-lambda. Fix the import to resolve the build error: "Property 'Size' does not exist on type 'typeof import(...aws-lambda/index)'".
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
lpizzinidev
left a comment
There was a problem hiding this comment.
Ty for the contribution! However, the change is no longer necessary after #38662
|
Automated review A maintainer will still review this — treat the notes below as a starting point. This PR improves the The fix is low-risk and message-only: 🔴 0 blocking · 🟡 0 recommended · ⚪ 1 optional Files with findings (1)
Generated automatically. React 👍 or 👎 to tell us whether this review helped, so we can improve these reviews. |
There was a problem hiding this comment.
See the review summary comment for the overview; the notes below are inline.
| // A valid ephemeral storage size (within 512-10240 MiB range). | ||
| // This validates that the out-of-range check passes for valid inputs | ||
| // after the error message fix was applied. | ||
| new lambda.Function(stack, 'LambdaWithEphemeralStorage', { | ||
| runtime: lambda.Runtime.NODEJS_20_X, | ||
| handler: 'index.handler', | ||
| code: lambda.Code.fromInline('exports.handler = async () => {};'), | ||
| ephemeralStorageSize: Size.mebibytes(1024), | ||
| }); |
There was a problem hiding this comment.
⚪ Optional — This new integ test exercises only a valid ephemeral storage size (Size.mebibytes(1024)), so it never touches the out-of-range error path this change actually fixes — and it cannot, since an out-of-range value throws at synth time and can never be deployed. The behavior under change is a validation message string, which the tightened unit test already covers and catches regressions for. The test's own comment references an "out-of-range check" the test does not trigger, and the result is a new synthesized snapshot for a cosmetic message change (INTEGRATION_TESTS.md).
Suggested change: Consider dropping the integ test and its snapshot and relying on the unit-test update alone, since the changed error string is only coverable at the unit level. If the intent is genuinely to add first-time deploy coverage for ephemeralStorageSize, keep the test but update the comment to state that goal rather than referencing an out-of-range check it never triggers.
|
Comments on closed issues and PRs are hard for our team to see. |
The out-of-range error interpolated the Size object directly into the message. Size has no toString(), so the value rendered as [object Object] and gave no indication of what was actually passed. Convert to mebibytes in the message, matching the conversion already performed by the range check on the line above.
Fixes #38621