-
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
Problem with auto-naming of singleton lambda functions #5616
Comments
I have the same issue with logical id generation in general. I set a I cleaned up logical ids by overriding allocateLogicalId. I understand the reasoning behind the unique id generation and logical id stability. It makes it difficult to identity resources (especially in nested stacks). It seems to have been discussed before in #1424 and #1594. I would appreciate guidance from the CDK team as well. |
Reading the docs it seems you should be able to override the logical id generation however this doesn't work in my tests.
When I use this code on a lambda.SingletonFunction I get a runtime undefined error:
|
I ran into the same issue. The method definitely exists on
EDIT Looks like |
@reidca & @cmckni3 - we have an option for this called Have you tried using that? |
@nija-at yes, I figured that out. Is it possible to override purpose on CDK provided custom resources? |
Can I understand why the Lambda.SingletonFunction is different from the Lambda.Function in the way they are named by CDK? |
The This allows for another construct to define a lambda function as part of its construction (using On the other hand, the regular Hope that makes sense? Closing this issue for now. Please reopen if there's something I've missed. |
relates #5616 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
The Question
When creating a Singleton Lambda function (https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.SingletonFunction.html) and not specifying the FunctionName property specifically, CDK creates a name in the format "StackName-SingletonLambdaGUID"
e.g. S3FtpStack-SingletonLambda0d11343f709a4e728c0caf32-XRCK830I30HY
If you have multiple singleton lambda functions this makes it impossible to work out what the function does since they look identical apart from the guid at the end.
I would have expected CDK to use the resource name provided to stem the function name just like it does when creating a lambda.Function.
e.g. S3FtpStack-ftpUploaderHandler6825122D-1LK6V6JG68LPJ
I do not want to name the function specifically because this then makes it impossible for cloudformation to replace the function.
Is this expected behaviour? If so why and could it be changed?
Environment
The text was updated successfully, but these errors were encountered: