CDK Bootstrap should not try to process cdk.json
See original GitHub issueI noticed that running cdk bootstrap
causes it to process the cdk.json
file (if one is present). I believe this is a bug as the bootstrap process should have no reason to look at any specific app configuration.
Reproduction Steps
We use Typescript and we compile this only when deploying our stack (i.e. when running cdk deploy
). This means the transpiled Typescript files are not present when running cdk bootstrap
as follows:
cdk bootstrap aws://************/eu-west-2
Error Log
Bootstrapping aws://************/eu-west-2
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '.build/stacks/number-management-api-stacks.js'
Environment
- CLI Version :1.39.0
- OS :Mac 10.15.4 (19E287)
- Language :Typescript
Snippet of relevant packages in package.json
:
"devDependencies": {
"@aws-cdk/assert": "^1.39.0",
"@aws-cdk/aws-appsync": "^1.39.0",
"@aws-cdk/aws-cognito": "^1.39.0",
"@aws-cdk/aws-ec2": "^1.39.0",
"@aws-cdk/aws-iam": "^1.39.0",
"@aws-cdk/aws-lambda": "^1.39.0",
"@aws-cdk/aws-rds": "^1.39.0",
"@aws-cdk/aws-s3": "^1.39.0",
"@aws-cdk/aws-secretsmanager": "^1.39.0",
"@aws-cdk/aws-sns": "^1.39.0",
"@aws-cdk/aws-sns-subscriptions": "^1.39.0",
"@aws-cdk/aws-sqs": "^1.39.0",
"@aws-cdk/core": "^1.39.0",
"@types/aws-lambda": "^8.10.51",
"@types/node": "^14.0.1",
"aws-cdk": "^1.39.0",
"aws-lambda": "^1.0.6",
"aws-sdk": "^2.678.0",
"ts-node": "^8.10.1",
"typescript": "^3.8.3"
},
For reference, this is the contents of the cdk.json
file:
{
"app": "node .build/stacks/number-management-api-stacks.js"
}
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Troubleshooting common AWS CDK issues
To avoid generating unexpected AWS charges, the AWS CDK does not automatically bootstrap any environment. You must explicitly bootstrap each environment ...
Read more >TroubleShoot - Workshop Studio
Deployment requires certain AWS resources to be available, and these resources are provisioned by bootstrapping. Execute “cdk bootstrap” to fix this error.
Read more >Least deployment privilege with CDK Bootstrap - Better Dev
To start using the CDK, we must bootstrap our AWS account. Bootstrapping creates the resources required by the CDK on the account. If...
Read more >CDK Cross-Account Pipelines - AWS in Plain English
There are two other requirements for CDK Bootstrap that are not obvious in the AWS documentation: We need to specify any other accounts...
Read more >AWS CDK new synthesizer version - Stack Overflow
Error: Could not assume role in target account (did you bootstrap the environment with the right '--trust's?) I use this command cdk deploy...
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
A flag to opt out of this behaviour would indeed be useful. We do not use the structure generated by the CLI as it doesn’t quite fit in with our way of working. I will try and write up a short summary of how we are using the CDK and add it in a comment here later this evening.
I understand your reasoning but it still doesn’t /feel/ right to me. The less surprising thing would be for bootstrap to be completely independent of any app-specific settings.
In my case I have had to put in a workaround where I deleted the
cdk.json
file and instead added the –app flag to all other cdk commands I am running - which is a pain.