-
Notifications
You must be signed in to change notification settings - Fork 4k
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
CustomResource: ServiceToken clobbered by properties #32468
Comments
@Shwaring Good morning. Thanks for opening the issue. Yes, per CustomRessource implementation here, Could you please confirm if there any specific use case where Either the case, I also think that there should be a check for |
The serviceToken is a required field. So I think most most people would reasonable expect the service token to be the one set in that field not in properties. There fore I cannot see a use case where someone would want to set the service token on the properties parameters. Furthermore, the documentation on the properties explicitly says it is passed to the lambda, not that it sets properties for the custom resource. So I was not expecting my properties to have any effects on the custom resource. "properties? Properties to pass to the Lambda." Perhaps if we were seeking a side affect free fix for this issue a simple rewording of this documentation to convey that the properties will clobber the explicitly set values of the custom resource. |
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: