Skip to content

fix: fail at synth when NextjsDomain would create a cert outside us-east-1 - #285

Open
revmischa wants to merge 1 commit into
mainfrom
fix/domain-certificate-region
Open

revmischa wants to merge 1 commit into
mainfrom
fix/domain-certificate-region

Conversation

@revmischa

Copy link
Copy Markdown
Member

NextjsDomain creates its ACM certificate in the stack's region, but CloudFront only accepts certificates from us-east-1. A stack in eu-west-1 without a certificate prop synthesizes fine and then fails when CloudFront rejects the cert at deploy time. That's what #255 hit after upgrading from 3.x, which used to create the cert in us-east-1 via a cross-region function.

Now it throws at synth with a message pointing at the certificate prop and crossRegionReferences. Environment-agnostic stacks are skipped since their region is a token until deploy. No working setup changes behaviour, since anything that hits the new error couldn't deploy before either.

I didn't bring back the 3.x behaviour of creating the cert in us-east-1 automatically. The only built-in way is the deprecated DnsValidatedCertificate, and the supported route is a separate us-east-1 stack, which a construct can't create on its own.

Adds the first construct tests for NextjsDomain.

Fixes #255

🤖 Generated with Claude Code

…ast-1

NextjsDomain creates its ACM certificate in the stack's region, but
CloudFront only accepts certificates from us-east-1. Stacks in other
regions synthesized fine and then failed at deploy time. Throw a clear
error at synth instead, pointing at the certificate prop and cross
region references. Environment-agnostic stacks are left alone since
their region isn't known until deploy.

Fixes #255

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nextjsDomain Creates Cerificates in Wrong Region in Version 4.2.4

1 participant