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

process.env.CDK_DEFAULT_ACCOUNT and process.env.CDK_DEFAULT_REGION don't work #4372

Closed
hacker65536 opened this issue Oct 4, 2019 · 3 comments
Assignees
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug. needs-reproduction This issue needs reproduction.

Comments

@hacker65536
Copy link
Contributor

hacker65536 commented Oct 4, 2019

These environments worked before. Didn't need to install @types/node.

Reproduction Steps

new VpcStack(app, "VpcStack", {
  env: {
    account: process.env.CDK_DEFAULT_ACCOUNT,
    region: process.env.CDK_DEFAULT_REGION,
  },
});

Error Log

$ npm run build

> [email protected] build /home/ec2-user/vpc
> tsc

bin/vpc.ts:9:14 - error TS2580: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i @types/node`.

9     account: process.env.CDK_DEFAULT_ACCOUNT,
               ~~~~~~~

bin/vpc.ts:10:13 - error TS2580: Cannot find name 'process'. Do you need to install type definitions for node? Try `npm i @types/node`.

10     region: process.env.CDK_DEFAULT_REGION,
               ~~~~~~~


Found 2 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ec2-user/.npm/_logs/2019-10-04T07_22_12_135Z-debug.log

Environment

  • CLI Version :1.11.0 (build 4ed4d96)
  • Framework Version:
  • OS :Amazon linux 2
  • Language :typescript

Other


This is 🐛 Bug Report

@hacker65536 hacker65536 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 4, 2019
@NGL321 NGL321 added package/tools Related to AWS CDK Tools or CLI @aws-cdk/core Related to core CDK functionality needs-reproduction This issue needs reproduction. and removed package/tools Related to AWS CDK Tools or CLI needs-triage This issue or PR still needs to be triaged. labels Oct 4, 2019
@eladb
Copy link
Contributor

eladb commented Oct 10, 2019

We used to include @types/node in "cdk init" but this was removed since it is not required in normal cases (#3840). You should simply npm i -D @types/node if you process.env.

I will make sure we update the relevant documentation topic so this is less surprising.

Also, this behaviour is likely to be changed when we implement #4131

@eladb
Copy link
Contributor

eladb commented Oct 10, 2019

Doc fix: awsdocs/aws-cdk-guide#132

@eladb eladb closed this as completed Oct 10, 2019
@hacker65536
Copy link
Contributor Author

Thank you for your explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug. needs-reproduction This issue needs reproduction.
Projects
None yet
Development

No branches or pull requests

3 participants