bug: CloudFormation custom resources: ServiceTimeout ignored, Update requests lack OldResourceProperties/PhysicalResourceId, and a Lambda provider running over 60 s is re-invoked every minute
#60
k-rooot
started this conversation in
Bugs (AWS)
Replies: 1 comment
|
Hi @k-rooot, thanks for flagging this. We've reproduced all four, confirmed them against real AWS, and handed them to engineering. We'll follow up here once a fix lands so you can verify it. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Current behavior
Four differences from AWS show up with Lambda-backed custom resources (
Custom::*/AWS::CloudFormation::CustomResource):ServiceTimeoutis ignored. A custom resource whose provider never replies staysCREATE_IN_PROGRESS.ServiceTimeout: 30, the stack was stillCREATE_IN_PROGRESSafter 230 s. An earlier run withServiceTimeout: 60was stillCREATE_IN_PROGRESSafter 300 s. A provider that raises an exception without replying behaves the same way.Updaterequests carry noOldResourcePropertiesand noPhysicalResourceId."RequestType": "Update", "PhysicalResourceId": null, "OldResourceProperties": nullDeleterequest'sResourcePropertiesalso contain the keys from the provider's earlier responseData.Mode,ServiceTokenandValue. The Delete request getsEcho,Mode,ServiceTokenandValue, whereEchois a key the provider returned inData.Item C comes from Lambda asynchronous invocation, not from CloudFormation. A single
InvokewithInvocationType=Eventof a plain function that succeeds after 75 s runs about once a minute with the same request id. That was 5 runs in 300 s, and in a longer run 9 runs in 400 s with no sign of stopping. The LocalStack log shows no function error. Each re-run starts while the previous one is still running.Practical consequences:
OldResourcePropertieswithResourcePropertiesalways choose "replace". An example is the AWS CDK DNS-validated certificate requestor, which requests a new certificate on every update.Expected behavior
As on AWS:
ServiceTimeoutseconds pass without a response. "The maximum time, in seconds, that can elapse before a custom resource operation times out. The value must be an integer from 1 to 3600. The default value is 3600 seconds (1 hour)." (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudformation-customresource.html). See also "Response timeout" in https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html: "If no response is received during this time, the stack operation fails."PhysicalResourceId(Required: Yes) andOldResourceProperties("The resource property values that were previously declared by the template developer in the CloudFormation template. Required: Yes").ResourceProperties"contains the contents of the Properties object sent by the template developer". ResponseDatais not merged into it (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/crpg-ref.html).How are you starting LocalStack?
With a
docker runcommand:Steps to reproduce
Self-contained script (boto3 only, about 5 minutes). It creates three small stacks, each with an inline Python provider: one that never replies (with
ServiceTimeout: 30), one that takes 70 s, and one that is updated. It also makes a single asynchronous invoke of a plain function that takes 75 s. Script:Output (
localstack/localstack-pro:2026.8.1;2026.7.5gives the same result):The provider sends one reply per invocation (
REPLIED). In part C the first invocation is still running when the second and third start.Environment
localstack/localstack-pro:2026.7.5andlocalstack/localstack-pro:2026.8.1Anything else?
Workarounds:
Replies to the
ResponseURL(http://s3.localhost.localstack.cloud:4566/...) work from Lambda containers with default settings. That includes providers that forcehttpson port 443, as the AWS CDK providers do. So the hang in A is not a connectivity problem.All reactions