CustomResource: ServiceToken clobbered by properties #32468
Labels
@aws-cdk/custom-resources
Related to AWS CDK Custom Resources
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
p2
Describe the bug
The properties construct props implies that all the properties are sent to the lambda. However if a key
ServiceToken
is added to the properties object it will set the service token for the custom resource, and even overwrite the value provided in the seviceToken constructor prop.Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The service token of the custom resource should always be the value provided in serviceToken
Current Behavior
The ServiceToken property of the custom resource is overwritten with the value in the property.
Reproduction Steps
Warning
Deploying this stack will fail and take 2 hours too resolve due to custom resource timeout, Only synth is needed to verify the bug.
Create a basic typescript cdk app,
update ./bin/test_app.ts
Run CDK synth and observe the cdk.out/TestCdkAppStack.template.json. See that the invoker has the service token of the lambda function instead of the provider.
Comment out the
properties
attribute of the custom resource and synth again. Observe that it is now correctly has the service token of the provider,Possible Solution
properties object overwrites the invokers base properties. Potentially provide a warning of this.
Additional Information/Context
No response
CDK CLI Version
2.171.1 (build a95560c)
Framework Version
No response
Node.js Version
v20.12.2
OS
linux
Language
TypeScript
Language Version
5.6.3
Other information
No response
The text was updated successfully, but these errors were encountered: