I'm trying to deploy a next.js app to AWS using serverless. However, when I try to deploy, I get this error:

Serverless Error ---------------------------------------

  An error occurred: ApiDistribution - One or more of the CNAMEs you
provided are already associated with a different resource. (Service:
AmazonCloudFront; Status Code: 409; Error Code: CNAMEAlreadyExists

I haven't (as far as I'm aware) created any CNAME records for this domain, and it's a brand new domain, so it's unlikely there would be any old CloudFront configurations hanging about anywhere. How can I figure out what CloudFront resource has reserved this domain so I can clear it?

Possibly useful: the cloudfront bit of my serverless.yml

  certificateArn: CERT-ARN
    domainName: prod.DOMAIN.com
    certificateArn: ${self:custom.certificateArn}
    createRoute53Record: true
  # Deploy CloudFront CDN
    domain: projects.DOMAIN.com
      - ***
    certificate: ${self:custom.certificateArn}
    compress: true
    minimumProtocolVersion: TLSv1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.