(synthetics): auto delete underlying resources handler returns a misspelled PhysicalResourceId on Create
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 87/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- aws, node.js, typescript
- Domain
- backend-api-design, cloud
Research direction
Read packages/@aws-cdk/custom-resource-handlers/lib/aws-synthetics/auto-delete-underlying-resources-handler/index.ts at line 16 and inspect the Create response. The body identifies the misspelled key and describes the expected behavior; the reproduction shows the failing result. Done when Create returns PhysicalResourceId set to the canary name and the handler unit tests pass.
Written by the indexing model from the issue text.
Description
Describe the bug
The Custom::SyntheticsAutoDeleteUnderlyingResources handler answers a Create event with { PhyscialResourceId: <canary name> }. The key is misspelled, so the entrypoint ignores it and records the CloudFormation request id as the physical resource id instead of the canary name.
The Update path returns the canary name and relies on CloudFormation comparing it with the id recorded at Create to decide whether a Delete for the old resource is needed (see the comment in onUpdate). With the request id recorded at Create, the first Update of the custom resource whose properties change for a reason other than the canary name (the ServiceToken, for example) returns a different physical id, CloudFormation treats it as a replacement and sends a Delete with the old properties. That Delete finds the canary tagged aws-cdk:auto-delete-underlying-resources and deletes the Lambda function behind the live canary.
Handler: packages/@aws-cdk/custom-resource-handlers/lib/aws-synthetics/auto-delete-underlying-resources-handler/index.ts, line 16.
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Library Version
The line has been misspelled since the handler was added in #26580.
Expected Behavior
The Create response carries PhysicalResourceId set to the canary name, so an Update that keeps the canary name does not change the physical id.
Current Behavior
The Create response has no PhysicalResourceId; the physical id becomes the request id. An Update that keeps the canary name changes the physical id to the canary name.
Reproduction Steps
const result = await autoDeleteHandler({
RequestType: 'Create',
ResourceProperties: { ServiceToken: 'Foo', CanaryName: 'MyCanary' },
});
// result is { PhyscialResourceId: 'MyCanary' }, result.PhysicalResourceId is undefined
A synthetics.Canary with cleanup: synthetics.Cleanup.LAMBDA shows the request id as the physical id of AutoDeleteUnderlyingResourcesCustomResource in the CloudFormation console after the first deployment.
Possible Solution
Spell the key PhysicalResourceId.
AWS CDK Library version (aws-cdk-lib)
2.275.0 (handler source identical on main at 2674cecfc7)
AWS CDK CLI version
Not used for the reproduction; the handler was exercised with the package unit tests.
Node.js Version
v26.5.0 (local unit test run)
OS
macOS (Darwin 25.6.0)
Language
TypeScript
- Dominant language
- TypeScript
- Stars
- 13k
- Forks
- 4.7k
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 98
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws/aws-cdk
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
aws/aws-cdk#39693 · 1 comment ·
Maintainers usually reply within 1 day
-
@aws-cdk/aws-iam needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
aws-cdk-lib needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
(stepfunctions-tasks): EmrCreateCluster rejects JsonPath values for ebsRootVolumeSize, ebsRootVolumeIops, ebsRootVolumeThroughput and releaseLabelPossibly taken @haeganm claimed this 7 days ago. Open@aws-cdk/aws-stepfunctions-tasks bug effort/medium p2 potential-regression
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
aws/aws-cdk#39646 · 1 comment ·
Maintainers usually reply within 1 day
-
RDS: Add missing instance-engine versionPossibly taken @daanvzijl claimed this 7 days ago. Open@aws-cdk/aws-rds feature-request p2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
aws/aws-cdk#39639 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
jupyterlite/jupyterlite#2111 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
karlhorky/electron-app-patcher#241 ·
Maintainers usually reply within 1 day
-
Tab bar scrolls past its last tab in Firefox until no tabs are visiblePossibly taken @daviwil claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eclipse-theia/theia#18367 ·
Maintainers usually reply within 2 days
-
Server-side render fails with "requestAnimationFrame is not defined" when the room has a video nodePossibly taken @jesusmpc claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
InditexTech/weavejs#1294 ·
Maintainers usually reply within 1 day