Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): improve context providers error message for env-agnostic stacks #3137

Merged
merged 3 commits into from
Jul 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/@aws-cdk/core/lib/context-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ export class ContextProvider {
const stack = Stack.of(scope);

if (Token.isUnresolved(stack.account) || Token.isUnresolved(stack.region)) {
throw new Error(`Cannot retrieve value from context provider ${options.provider} since account/region are not specified at the stack level`);
throw new Error(`Cannot retrieve value from context provider ${options.provider} 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)`);
}

const { key, props } = this.getKey(scope, options);
Expand Down