Skip to content

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

@ajkerr

Description

@ajkerr

Describe the bug

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.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

No response

Expected Behavior

The underlying CloudFormation stack should not be drifted.

Current Behavior

The stack is in drifted state after deployment:

Expected:

{
  "SubDomainSettings": [
    {
      "BranchName": "master",
      "Prefix": ""
    }
  ],
  "AppId": "xxxyyyzzz",
  "AutoSubDomainIAMRole": "arn:aws:iam::xxxyyyzzz",
  "DomainName": "mysubdomain.mydomain.com",
  "EnableAutoSubDomain": false,
  "AutoSubDomainCreationPatterns": [
    "*",
    "pr*"
  ]
}

Actual:

{
  "SubDomainSettings": [
    {
      "BranchName": "master"
    }
  ],
  "AppId": "xxxyyyzzz",
  "AutoSubDomainIAMRole": "arn:aws:iam::xxxyyyzzz",
  "DomainName": "mysubdomain.mydomain.com",
  "EnableAutoSubDomain": false,
  "AutoSubDomainCreationPatterns": [
    "*",
    "pr*"
  ]
}

Reproduction Steps

Add a custom domain with a blank prefix like so:

amplify_app.add_domain('AppDomain',
    domain_name = 'mysubdomain.mydomain.com',
    sub_domains = [amplify.SubDomain(prefix = '', branch = 'master')]
)

As specified by the documentation for amplify.SubDomain, we: Use '' to map to the root of the domain.

Possible Solution

No response

Additional Information/Context

No response

AWS CDK Library version (aws-cdk-lib)

2.222.0-alpha.0

AWS CDK CLI version

2.1031.1

Node.js Version

v24.11.0

OS

macOS 15.7.1

Language

Python

Language Version

3.14.0

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-amplifyRelated to AWS AmplifybugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions