route53.HostedZone.fromLookup returned error
See original GitHub issueI have a hosted zone on route53, and use the following CDK code (typescript
) to look up that zone using domainName
, but got error while running cdk synth
, cdk diff
and cdk deploy
. After changing to use route53.HostedZone.fromHostedZoneAttributes()
, it works.
Reproduction Steps
const zone = route53.HostedZone.fromLookup(this, 'Zone', { domainName: props.domainName });
Error Log
Cannot retrieve value from context provider hosted-zone since account/region are not specified at the stack level. Either configure "env" with explicit account and region when you define your stack, or use the environment variables "CDK_DEFAULT_ACCOUNT" and "CDK_DEFAULT_REGION" to inherit environment information from the CLI (not recommended for production stacks)
Subprocess exited with error 1
Environment
- CLI Version : 1.19.0 (build 5597bbe)
- Framework Version:1.19.0
- OS :macOS Mojave version 10.14.6
- **Language :typescript **
Other
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Reactions:20
- Comments:21 (10 by maintainers)
Top Results From Across the Web
class HostedZone (construct) · AWS CDK
Import a Route 53 hosted zone defined either outside the CDK, or in a different CDK stack. static fromLookup(scope, id, query), Lookup a...
Read more >No hosted zone found with ID error when deploying
const zone = route53.HostedZone.fromLookup(this, 'Zone', { domainName: domainName });. When I deploy, I get the following error
Read more >awslabs/aws-cdk - Gitter
Now I'm hitting this point :( const authHostedZone = route53.HostedZone.fromLookup(this, "AuthHostedZone", { domainName: authRecord // This is Token.
Read more >aws-solutions-constructs.aws-route53-apigateway - PyPI
CDK constructs for connecting an Amazon Route53 domain to an API Gateway. ... fromLookup(this, "HostedZone", new HostedZoneProviderProps.Builder() .
Read more >CDK domain cert setup for a static site - What must be done ...
I have purchased a domain through Route53. I have also manually created a public hosted zone for the domain. The problem I'm having...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
cdk 2.29.0
I think the reason synth succeeds while deploy fails when using HostedZoneFromLookup is that the cdk optimistically assumes a successful lookup.
Here’s the synth output for domainHostedZone.HostedZoneId() (using Golang): DUMMY
That looks like a placeholder value in case of unsuccessful lookups.
In fact, after having fought this for a couple of hours, I think the answer to “why does the zone lookup sometimes fail” in my case is eventual consistency. After deleting and recreating the stack/zone in question a few times, I went for a walk, retried and the zone was now “found”.
I have not looked into the JS or Golang implementations yet, but I suspect many may be falling victims to the CDK trying to fallback to a dummy zone instead of failing outright.
Hi, I found what is the problem:
Is related to my alias creatio. Before I was using:
I changed it to:
And now its working o0
Thanks guys