@aws-cdk/custom-resources: not possible to update from 1.79.0 => 1.100.0
See original GitHub issueCustom resources recently changed the encoding of their parameters to a JSON string. This appears to make it impossible to update CDK or the custom resources module from 1.79 to 1.100. Previous versions did not require a JSON.parse
call in the lambda to read the custom resource parameters.
Reproduction Steps
- Deploy a custom resource on cdk@1.79.0 + @aws-cdk/custom-resources@1.79.0.
- Update to cdk@1.100.0 + @aws-cdk/custom-resources@1.100.0.
- Deploy the same custom resource.
What did you expect to happen?
It should deploy successfully without tearing down the stack which does not appear to be possible.
What actually happened?
Fails to deploy with an error: awsService[call.action] is not a function.
This is because call
is a JSON blob on 1.100 instead of an object as in 1.79. This blob isn’t parsed in the old lambda and so action
is not a property of call
.
Environment
- CDK CLI Version: 1.79.0
- Framework Version: 1.79.0
- Node.js Version: 14.16.1
- OS: MacOS Big Sur 11.2.3 (20D91)
- Language (Version): Node 14.16.1
Other
user@Users-MacBook-Pro repo % cdk deploy MyStack --force
MyStack: deploying...
[0%] start: Publishing a5a55f40f05c1031f30cc935c76b58b0b7dbc81e70845edf4ef615d6580ae04d:current
[50%] success: Published a5a55f40f05c1031f30cc935c76b58b0b7dbc81e70845edf4ef615d6580ae04d:current
[50%] start: Publishing 67b7823b74bc135986aa72f889d6a8da058d0c4a20cbc2dfc6f78995fdd2fc24:current
[100%] success: Published 67b7823b74bc135986aa72f889d6a8da058d0c4a20cbc2dfc6f78995fdd2fc24:current
MyStack: creating CloudFormation changeset...
1:43:48 PM | UPDATE_FAILED | Custom::AWS | CustomGroupThingGroup16FE0278
Invalid PhysicalResourceId
new CustomResource (/Users/user/Projects/repo/node_modules/@aws-cdk/core/lib/custom-resource.js:30:25)
\_ new AwsCustomResource (/Users/user/Projects/repo/node_modules/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-d response status [FAILED] from custom resource. Message returned: awsService[call.action] is not a function (RequestId:
custom-resource.js:213:31)
\_ new IoTThingGroup (/Users/user/Projects/repo/lib/constructs/IoTThingGroup.js:19:28)
\_ new MyStack (/Users/user/Projects/repo/lib/stacks/MyStack.js:152:33)
\_ Object.<anonymous> (/Users/user/Projects/repo/bin/repo.js:35:24)
\_ Module._compile (internal/modules/cjs/loader.js:1063:30)
\_ Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
\_ Module.load (internal/modules/cjs/loader.js:928:32)
\_ Function.Module._load (internal/modules/cjs/loader.js:769:14)
\_ Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
\_ internal/main/run_main_module.js:17:47
[██████████▌···············································] (2/11)
1:43:48 PM | UPDATE_FAILED | Custom::AWS | CustomGrou...p/Resource/Default
Invalid PhysicalResourceId
1:43:48 PM | UPDATE_FAILED | Custom::AWS | GreengrassV2IoTThi...y/Resource/Default
Received response status [FAILED] from custom resource. Message returned: awsService[call.action] is not a function (RequestId:
6bf48d89-7c2e-485f-a674-d300a95693e0)
1:43:50 PM | UPDATE_ROLLBACK_IN_P | AWS::CloudFormation::Stack | MyStack
The following resource(s) failed to update: [DefaultThingGroupC189758C, GreengrassV2IoTThingPolicyC8BED6A5, CustomGroup
ThingGroup16FE0278, GreengrassTokenExchangeRoleAliasFA0CF103].
1:44:51 PM | UPDATE_FAILED | Custom::AWS | CustomGrou...p/Resource/Default
Received response status [FAILED] from custom resource. Message returned: Missing required key 'thingGroupProperties' in params
(RequestId: 681ed503-b8d5-4e88-beee-41b036588aa8)
1:44:52 PM | UPDATE_ROLLBACK_FAIL | AWS::CloudFormation::Stack | MyStack
The following resource(s) failed to update: [DefaultThingGroupC189758C, CustomGroupThingGroup16FE0278].
❌ MyStack failed: Error: The stack named MyStack failed to deploy: UPDATE_ROLLBACK_FAILED (The following resource(s) failed to update: [DefaultThingGroupC189758C, CustomGroupThingGroup16FE0278]. )
at Object.waitForStackDeploy (/usr/local/lib/node_modules/aws-cdk/lib/api/util/cloudformation.ts:307:11)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at Object.deployStack (/usr/local/lib/node_modules/aws-cdk/lib/api/deploy-stack.ts:297:26)
at CdkToolkit.deploy (/usr/local/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:180:24)
at initCommandLine (/usr/local/lib/node_modules/aws-cdk/bin/cdk.ts:208:9)
The stack named MyStack failed to deploy: UPDATE_ROLLBACK_FAILED (The following resource(s) failed to update: [DefaultThingGroupC189758C, CustomGroupThingGroup16FE0278]. )
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (8 by maintainers)
Top Results From Across the Web
Unable to install pipelines library with CDK >= 2.0 · Issue ...
I'm trying to install aws_cdk.pipelines library in a new project that was created following the page https://docs.aws.amazon.com/cdk/v2/guide/ ...
Read more >aws-cdk/custom-resources module - AWS Documentation
AWS CloudFormation custom resources are extension points to the provisioning engine. When CloudFormation needs to create, update or delete a custom resource ......
Read more >@aws-cdk/custom-resources | Yarn - Package Manager
When CloudFormation needs to create, update or delete a custom resource, it sends a lifecycle event notification to a custom resource provider. The...
Read more >core 1.181.1 javadoc (software.amazon.awscdk)
To specify how AWS CloudFormation handles rolling updates for an Auto Scaling group, ... Properties to provide a Lambda-backed custom resource.
Read more >@aws-cdk/aws-lambda - NPM Package Overview - Socket
Further note that, if the log group already exists and the logRetention is not set, the custom resource will reset the log retention...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Let’s try the other way around:
onUpdate
andonDelete
callsonUpdate
andonDelete
callsCan you try this?
onUpdate
andonDelete
callsonUpdate
andonDelete
call