Skip to content

fix(elasticache-alpha): deployment fails when serverlessCacheName or userGroupId is not specified#36459

Merged
mergify[bot] merged 7 commits intoaws:mainfrom
mazyu36:fix-36458
Jan 6, 2026
Merged

fix(elasticache-alpha): deployment fails when serverlessCacheName or userGroupId is not specified#36459
mergify[bot] merged 7 commits intoaws:mainfrom
mazyu36:fix-36458

Conversation

@mazyu36
Copy link
Copy Markdown
Contributor

@mazyu36 mazyu36 commented Dec 19, 2025

Issue # (if applicable)

Closes #36458

Reason for this change

When deploying an ElastiCache ServerlessCache or UserGroup without explicitly specifying a serverlessCacheName or userGroupId, the auto-generated name can exceed AWS ElastiCache's 40-character limit, causing deployment failures.

The current implementation uses Names.uniqueId() which generates names without length constraints. With longer stack names or construct paths, the generated identifier exceeds the service's maximum allowed length.

Description of changes

Replace the name generation logic with Names.uniqueResourceName(this, { maxLength: 40 }) to ensure generated names respect the AWS limit:

Description of how you validated changes

Added integration test integ.serverless-cache-auto-generate-name.ts that creates a ServerlessCache and UserGroup without specifying names.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team December 19, 2025 13:13
@github-actions github-actions Bot added bug This issue is a bug. p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Dec 19, 2025
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@aws-cdk-automation aws-cdk-automation dismissed their stale review December 23, 2025 14:11

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 23, 2025

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results48 ran48 passed
TestResult
No test annotations available

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 23, 2025

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results with resolved templates48 ran48 passed
TestResult
No test annotations available

@mazyu36 mazyu36 marked this pull request as ready for review December 23, 2025 14:16
@github-actions github-actions Bot added the effort/medium Medium work item – several days of effort label Dec 23, 2025
@mazyu36
Copy link
Copy Markdown
Contributor Author

mazyu36 commented Dec 23, 2025

Exemption Request: Existing unit tests already cover auto-generated names, and the integration test validates the 40-character limit in the generated snapshot.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Dec 23, 2025
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Dec 26, 2025
Comment thread packages/@aws-cdk/aws-elasticache-alpha/lib/user-group.ts Outdated
this.engine = props.engine ?? CacheEngine.VALKEY_LATEST;
this.serverlessCacheName = props.serverlessCacheName ?? Lazy.string({ produce: () => Names.uniqueId(this) });
this.serverlessCacheName = props.serverlessCacheName ?? Lazy.string({
produce: () => Names.uniqueResourceName(this, { maxLength: 40 }),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for showing this very useful function(uniqueResourceName)!

@gasolima gasolima added the pr/needs-integration-tests-deployment Requires the PR to deploy the integration test snapshots. label Jan 5, 2026
@gasolima gasolima temporarily deployed to deployment-integ-test January 5, 2026 22:50 — with GitHub Actions Inactive
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Jan 6, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify Bot temporarily deployed to deployment-integ-test January 6, 2026 08:19 Inactive
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Jan 6, 2026

Merge Queue Status

✅ The pull request has been merged at aaf25cd

This pull request spent 49 minutes 33 seconds in the queue, including 49 minutes 23 seconds running CI.
The checks were run in-place.

Required conditions to merge

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jan 6, 2026
@mergify mergify Bot merged commit b3f62f7 into aws:main Jan 6, 2026
29 of 30 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 6, 2026

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jan 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug This issue is a bug. distinguished-contributor [Pilot] contributed 50+ PRs to the CDK effort/medium Medium work item – several days of effort p2 pr/needs-integration-tests-deployment Requires the PR to deploy the integration test snapshots. pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-elasticache-alpha): ServerlessCache deployment fails when serverlessCacheName is not specified

3 participants