Skip to content

Multiple warnings with aws-cdk-lib 2.224.0 #36078

@aramir

Description

@aramir

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

  • Select this option if this issue appears to be a regression.

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

  • No response

Metadata

Metadata

Assignees

Labels

aws-cdk-libRelated to the aws-cdk-lib packagebugThis issue is a bug.p1potential-regressionMarking this issue as a potential regression to be checked by team member

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions