-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(lambda-nodejs): incorrect SDK v2 warning generated #27014
fix(lambda-nodejs): incorrect SDK v2 warning generated #27014
Conversation
Annotations.fromStack(stack).hasNoWarning('*', | ||
'If you are relying on AWS SDK v3 to be present in the Lambda environment already, please explicitly configure a NodeJS runtime of Node 18 or higher. [ack: @aws-cdk/aws-lambda-nodejs:sdkV3NotInRuntime]', | ||
); | ||
Annotations.fromStack(stack).hasNoWarning('*', | ||
'If you are relying on AWS SDK v2 to be present in the Lambda environment already, please explicitly configure a NodeJS runtime of Node 16 or lower. [ack: @aws-cdk/aws-lambda-nodejs:sdkV2NotInRuntime]', | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking for "does not produce a warning" this way seems very brittle, but I couldn't see a better way from looking at https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.assertions.Annotations.html.
Guidance welcomed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
Exemption Request This fix only changes what warnings are generated, so no changes to integration tests or snapshots required. |
f2629e4
to
9eea420
Compare
@@ -882,6 +882,24 @@ test('bundling with <= Node16 warns when sdk v3 is external', () => { | |||
); | |||
}); | |||
|
|||
test('bundling with <= Node16 does not warn with default externalModules', () => { | |||
const myStack = new Stack(app, 'MyTestStack2'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appears that the warnings don't get cleared from the shared stack
after each run. This could invalidate some of the other tests in this file, but I decided to just fix it for my new tests, which fail without it.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was literally just working on this with the exact same solution and tests. LGTM! We should indeed move all the other unit tests to use their own unique stack
as well.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Fixes to remove an incorrectly generated warning when using Node JS runtime <= 16 with `NodejsFunction` Closes #26966 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
I'm not sure how can I disable this warning ? I'm using SDK v3 and I don't know how to disable the warning :\ |
Fixes to remove an incorrectly generated warning when using Node JS runtime <= 16 with
NodejsFunction
Closes #26966
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license