cli: when cdk.out is missing, cannot synthesize or list
See original GitHub issueI deleted my cdk.out/
directory hoping to freshly generate its contents next time I ran cdk synth
, but instead I get a file not found error.
Before I deleted cdk.out, synth, ls, and deploy were working fine.
Reproduction Steps
- rm -r cdk.out
- cdk ls
Error Log
ENOENT: no such file or directory, open 'cdk.out/manifest.json'
Environment
- CLI Version : 1.19.0
- Framework Version: 1.16.0
- OS : MacOS Catalina
- Language : Python
- Node version: v12.14.0
Other
> cdk --verbose ls
CDK toolkit version: 1.19.0 (build 5597bbe)
Command line arguments: {
_: [ 'ls' ],
verbose: true,
v: true,
'ignore-errors': false,
ignoreErrors: false,
json: false,
j: false,
ec2creds: undefined,
i: undefined,
'version-reporting': undefined,
versionReporting: undefined,
'path-metadata': true,
pathMetadata: true,
'asset-metadata': true,
assetMetadata: true,
'role-arn': undefined,
r: undefined,
roleArn: undefined,
staging: true,
'no-color': false,
noColor: false,
fail: false,
long: false,
l: false,
'$0': '/usr/local/bin/cdk'
}
Determining whether we're on an EC2 instance.
Does not look like EC2 instance.
cdk.json: {
"app": "python3 private_load_balancer.py"
}
merged settings: {
versionReporting: true,
pathMetadata: true,
output: 'cdk.out',
app: 'python3 private_load_balancer.py',
context: {},
tags: [],
assetMetadata: true,
toolkitBucket: {},
staging: true
}
Setting "CDK_DEFAULT_REGION" environment variable to us-west-2
Resolving default credentials
Retrieved account ID X from disk cache
Setting "CDK_DEFAULT_ACCOUNT" environment variable to X
context: {
'aws:cdk:enable-path-metadata': true,
'aws:cdk:enable-asset-metadata': true
}
outdir: cdk.out
env: {
CDK_DEFAULT_REGION: 'us-west-2',
CDK_DEFAULT_ACCOUNT: 'X',
CDK_CONTEXT_JSON: '{"aws:cdk:enable-path-metadata":true,"aws:cdk:enable-asset-metadata":true}',
CDK_OUTDIR: 'cdk.out',
CDK_CLI_ASM_VERSION: '1.16.0',
CDK_CLI_VERSION: '1.19.0'
}
ENOENT: no such file or directory, open 'cdk.out/manifest.json'
Error: ENOENT: no such file or directory, open 'cdk.out/manifest.json'
at Object.openSync (fs.js:440:3)
at Object.readFileSync (fs.js:342:35)
at new CloudAssembly (/usr/local/lib/node_modules/aws-cdk/node_modules/@aws-cdk/cx-api/lib/cloud-assembly.ts:77:36)
at Object.execProgram (/usr/local/lib/node_modules/aws-cdk/lib/api/cxapp/exec.ts:85:10)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at AppStacks.synthesizeStacks (/usr/local/lib/node_modules/aws-cdk/lib/api/cxapp/stacks.ts:205:24)
at AppStacks.listStacks (/usr/local/lib/node_modules/aws-cdk/lib/api/cxapp/stacks.ts:179:22)
at AppStacks.selectStacks (/usr/local/lib/node_modules/aws-cdk/lib/api/cxapp/stacks.ts:109:20)
at cliList (/usr/local/lib/node_modules/aws-cdk/bin/cdk.ts:337:20)
at main (/usr/local/lib/node_modules/aws-cdk/bin/cdk.ts:188:16)
This seems very similar to a previous issue: https://github.com/aws/aws-cdk/issues/3717 but I did not find a clear resolution in the comments on issue 3717. One comment said “went away when I updated my cdk.ts” but it is not clear to me whether I can or should do that. I installed CDK by npm install -g aws-cdk
, so I would expect all TypeScript to be “inside the black box”.
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Troubleshooting common AWS CDK issues
The file cdk.json in this directory, created by the cdk init command, contains the command line needed to run (and thereby synthesize) your...
Read more >awslabs/aws-cdk - Gitter
So it's only synthesizing one table and not completing the loop. It does the first record perfectly. What am I missing here? #!/usr/bin/env...
Read more >CLI Commands - CDK for Terraform
It can use the cdktf.json configuration file to read the list of providers and modules. This command only generates currently missing provider bindings, ......
Read more >How to install AWS CDK (step-by-step guide)
As you can see, the AWS CDK is running on version 2 (v2). Version 1 entered maintenance on June 1, 2022. If you...
Read more >AWS CDK Pipelines: Real-World Tips and Tricks (Part 2)
If you (as a developer) have the permissions to deploy a CDK pipeline, you can just redeploy a new pipeline which will directly...
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
I’ve independently found that
app.synth()
is required in Python. No idea why personallyAdding an
app.synth()
call to my Python script made it start working.Before:
After:
Perhaps I misunderstood the way synthesis works (I thought
app.synth()
would not be necessary if I am usingcdk synth
from the command line). If this is simply operator error, let me know and I will close this case.