Describe the bug
After updating aws-cdk-lib from 2.222.0 to 2.224.0 started getting multiple warnings during trmplate build (e.g.: running cdk diff or cdk deploy for all l,abda functions registered via NodejsFunction with warning message "ValidationError: The result of fromAwsManagedPolicyName can not be used in this API":
[Warning at /xxx/yyy/PreSignUpFn/ServiceRole] Failed to add construct metadata for node [ServiceRole]. Reason: ValidationError: The result of fromAwsManagedPolicyName can not be used in this API [ack: @aws-cdk/core:addConstructMetadataFailed]
[Warning at /xxx/yyy/PostConfirmationFn/ServiceRole] Failed to add construct metadata for node [ServiceRole]. Reason: ValidationError: The result of fromAwsManagedPolicyName can not be used in this API [ack: @aws-cdk/core:addConstructMetadataFailed]
...
the function registration itself is very basic/standard:
const preSignUpFn = new NodejsFunction(this, "PreSignUpFn", {
description: "Cognito preSignUp Trigger Function",
entry: path.join(__dirname, "../src/functions/cognito/preSignUp.ts"),
runtime: Runtime.NODEJS_22_X,
handler: "handler",
bundling: {
bundleAwsSDK: true
}
});
Regression Issue
Last Known Working CDK Library Version
aws-cdk-lib 2.222.0
Expected Behavior
No warnings shown
Current Behavior
Warnings "ValidationError: The result of fromAwsManagedPolicyName can not be used in this API" shown for each lambda function
Reproduction Steps
Create lambda function using NodejsFunction:
const preSignUpFn = new NodejsFunction(this, "PreSignUpFn", {
description: "Cognito preSignUp Trigger Function",
entry: path.join(__dirname, "../src/functions/cognito/preSignUp.ts"),
runtime: Runtime.NODEJS_22_X,
handler: "handler",
bundling: {
bundleAwsSDK: true
}
});
source code doesn't matter, empty handler function could be used
Possible Solution
No response
Additional Information/Context
No response
AWS CDK Library version (aws-cdk-lib)
2.224.0
AWS CDK CLI version
2.1031.2
Node.js Version
22.17.0
OS
Windows 10
Language
TypeScript
Language Version
5.6.3
Other information
Describe the bug
After updating
aws-cdk-libfrom2.222.0to2.224.0started getting multiple warnings during trmplate build (e.g.: runningcdk difforcdk deployfor all l,abda functions registered viaNodejsFunctionwith warning message "ValidationError: The result of fromAwsManagedPolicyName can not be used in this API":the function registration itself is very basic/standard:
Regression Issue
Last Known Working CDK Library Version
aws-cdk-lib 2.222.0
Expected Behavior
No warnings shown
Current Behavior
Warnings "ValidationError: The result of fromAwsManagedPolicyName can not be used in this API" shown for each lambda function
Reproduction Steps
Create lambda function using
NodejsFunction:source code doesn't matter, empty handler function could be used
Possible Solution
No response
Additional Information/Context
No response
AWS CDK Library version (aws-cdk-lib)
2.224.0
AWS CDK CLI version
2.1031.2
Node.js Version
22.17.0
OS
Windows 10
Language
TypeScript
Language Version
5.6.3
Other information