Skip to content

Conversation

@ajkerr
Copy link

@ajkerr ajkerr commented Nov 5, 2025

Issue # (if applicable)

Closes #35958

Reason for this change

After deploying a CDK stack containing an Amplify app with a custom domain that has a blank prefix, the underlying CloudFormation stack is immediately in "drifted" state.

Description of changes

Per the suggestions in the issue, I updated the renderSubDomainSettings method to omit the Prefix method from the resulting map when the supplied prefix is set to ''.

The existing fallback logic is preserved for falling back to branchName if prefix is null or undefined.

Describe any new or updated permissions being added

None.

Description of how you validated changes

Updated the corresponding test for mapping a branch to the domain root.

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 November 5, 2025 21:02
@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Nov 5, 2025
@ajkerr
Copy link
Author

ajkerr commented Nov 5, 2025

FYI @pahud

Copy link
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.

The pull request linter fails with the following errors:

❌ Fixes must contain a change to an integration test file and the resulting snapshot.
❌ The title prefix of this pull request must be one of "feat|fix|build|chore|ci|docs|style|refactor|perf|test|revert"

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

@ajkerr ajkerr changed the title Omit Prefix from SubDomainSettings when empty string is provided fix(aws-amplify-alpha) Omit Prefix from SubDomainSettings when empty string is provided Nov 5, 2025
@ajkerr
Copy link
Author

ajkerr commented Nov 5, 2025

This approach might not work: https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-amplify-domain-subdomainsetting.html#cfn-amplify-domain-subdomainsetting-prefix

The Prefix property is actually required at the CloudFormation level. Perhaps it's a bug in the drift detection or CloudFormation itself that is causing the Prefix attribute to disappear?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-amplify-alpha): Custom domain with blank prefix causes stack drift

2 participants