Daniel Gato
03/08/2022, 11:26 AMNot making progress trying to resolve environmental context. Giving up.
[Error at /staging-company-stack/Stack] Found zones: [] for dns:<http://dev.example.com|dev.example.com>, privateZone:undefined, vpcId:undefined, but wanted exactly 1 zone
Annotations.addMessage (/tmp/seed/source/node_modules/aws-cdk-lib/core/lib/annotations.ts:64:25)
Annotations.addError (/tmp/seed/source/node_modules/aws-cdk-lib/core/lib/annotations.ts:36:10)
Function.getValue (/tmp/seed/source/node_modules/aws-cdk-lib/core/lib/context-provider.ts:83:31)
Function.fromLookup (/tmp/seed/source/node_modules/aws-cdk-lib/aws-route53/lib/hosted-zone.ts:76:65)
ReactStaticSite.lookupHostedZone (/tmp/seed/source/node_modules/@serverless-stack/resources/src/StaticSite.ts:511:39)
new StaticSite (/tmp/seed/source/node_modules/@serverless-stack/resources/src/StaticSite.ts:101:28)
new ReactStaticSite (/tmp/seed/source/node_modules/@serverless-stack/resources/src/ReactStaticSite.ts:43:5)
new PlatformStack (/tmp/seed/source/stacks/PlatformStack.ts:11:18)
Object.main (/tmp/seed/source/stacks/index.ts:18:3)
Object.<anonymous> (/tmp/seed/source/.build/run.js:94:16)
Module._compile (internal/modules/cjs/loader.js:1063:30)
Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
Module.load (internal/modules/cjs/loader.js:928:32)
Function.Module._load (internal/modules/cjs/loader.js:769:14)
Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
internal/main/run_main_module.js:17:47
Found errors
Error: Found errors
at StackCollection.processMetadataMessages (/tmp/seed/source/node_modules/aws-cdk/lib/api/cxapp/cloud-assembly.ts:270:13)
at CdkToolkit.validateStacks (/tmp/seed/source/node_modules/aws-cdk/lib/cdk-toolkit.ts:549:12)
at CdkToolkit.selectStacksForDiff (/tmp/seed/source/node_modules/aws-cdk/lib/cdk-toolkit.ts:528:10)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at CdkToolkit.synth (/tmp/seed/source/node_modules/aws-cdk/lib/cdk-toolkit.ts:412:20)
at initCommandLine (/tmp/seed/source/node_modules/aws-cdk/bin/cdk.ts:268:9)
It seems you are configuring custom domains for you URL. And SST is not able to find the hosted zone "<http://dev.example.com|dev.example.com>" in your AWS Route 53 account. Please double check and make sure the zone exists, or pass in a different zone.
ERROR: Error: Found errors
ERROR: Failed to generate artifact for downstream stage staging.
This is our seed configuration.
Development pipeline
• Github dev
branch -> dev
environment
• on PR activity -> new environment
• on branch activity -> new environment
Staging pipeline
• Github main
branch -> staging
environment
Production pipeline
• Manually promote prod
environment
It seems that seed picks up the wrong AWS credentials during the last step.
📦 Build:
$ npx sst build --stage pr9 --verbose
...
Resolving default credentials
Retrieved account ID 24********** from disk cache
Setting "CDK_DEFAULT_ACCOUNT" environment variable to 24**********
context: {
'hosted-zone:account=24**********:domainName=<http://dev.example.com:region=us-east-1|dev.example.com:region=us-east-1>': { Id: '/hostedzone/Z02179983PO**********', Name: 'dev.example.com.' },
...
🗑️ Cleanup:
$ npx sst build --stage staging --verbose
...
Resolving default credentials
Looking up default account ID from STS
Default account ID: 01**********
Setting "CDK_DEFAULT_ACCOUNT" environment variable to 01**********
context: {
'hosted-zone:account=24**********:domainName=<http://dev.example.com:region=us-east-1|dev.example.com:region=us-east-1>': { Id: '/hostedzone/Z02179983PO**********', Name: 'dev.example.com.' },
...
On the settings page I can see that:
• Dev AWS IAM = custom (24**********)
• Prod AWS IAM = custom (its own)
• Staging AWS IAM = use default
• The PR AWS IAM = custom (24**********)
• The Branch AWS IAM = custom (24**********)
• Default settings = 01**********
I would assume that the last step is somehow using the default settings for PR and Branches.Frank
sst build
for the downstream stage.Frank
sst build --stage staging
with the Staging AWS IAM.Frank
Frank
Daniel Gato
03/09/2022, 9:02 AMDaniel Gato
03/09/2022, 9:03 AMthe downstream stage for a PR/Branch stage is StagingI’m not sure to understand what you mean with that. If you mean the next logical branch - in our case it is dev because we merge all our PRs to dev first.
Daniel Gato
03/09/2022, 9:10 AMDaniel Gato
03/09/2022, 9:11 AMFrank
app.stage
) instead of SEED_PULL_REQUEST_NUMBER
to determine whether you are building for staging or prod?Daniel Gato
03/09/2022, 9:27 AMconst isPullRequestOrBranch =
(isPullRequestDeploy || isBranchDeploy) && !isStaging;
Daniel Gato
03/09/2022, 9:27 AM