cfn-diagram icon indicating copy to clipboard operation
cfn-diagram copied to clipboard

Expects cdk.out/STACK_NAME.assets.template.json to exist after synth

Open l0b0 opened this issue 3 years ago • 1 comments

Running cfn-dia html --ci-mode results in the following error message:

$ cfn-dia html --ci-mode 
Bundling asset project/proccessing_lambda_function/Code/Stage...
node:fs:585
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, open 'cdk.out/STACK_NAME.assets.template.json'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at fromCDK ([…]/node_modules/@mhlabs/cfn-diagram/shared/templateParser.js:95:30)
    at Object.get ([…]/node_modules/@mhlabs/cfn-diagram/shared/templateParser.js:31:16)
    at Command.<anonymous> ([…]/node_modules/@mhlabs/cfn-diagram/commands/html/index.js:29:34)
    at Command.listener [as _actionHandler] ([…]/node_modules/commander/index.js:922:31)
    at Command._parseCommand ([…]/node_modules/commander/index.js:1503:14)
    at Command._dispatchSubcommand ([…]/node_modules/commander/index.js:1443:18)
    at Command._parseCommand ([…]/node_modules/commander/index.js:1460:12)
    at Command.parse ([…]/node_modules/commander/index.js:1292:10) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'cdk.out/STACK_NAME.assets.template.json'
}

Context:

$ cfn-dia --vers
1.1.28
$ cdk --version
1.119.0 (build 2921d64)

Workaround: Specify --template-file=cdk.out/STACK_NAME.template.json and run the command twice after clearing out the CDK cache - it seems to ignore the specified template name the first time I run it:

$ rm -rf cdk.out
$ DATABASE_URI='postgresql+psycopg2://[email protected]:5432/bde' poetry run cfn-dia html --ci-mode --template-file=cdk.out/STACK_NAME.template.json
Bundling asset STACK_NAME/proccessing_lambda_function/Code/Stage...
node:fs:585
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, open 'cdk.out/STACK_NAME.assets.template.json'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at fromCDK ([…]/node_modules/@mhlabs/cfn-diagram/shared/templateParser.js:95:30)
    at Object.get ([…]/node_modules/@mhlabs/cfn-diagram/shared/templateParser.js:31:16)
    at Command.<anonymous> ([…]/node_modules/@mhlabs/cfn-diagram/commands/html/index.js:29:34)
    at Command.listener [as _actionHandler] ([…]/node_modules/commander/index.js:922:31)
    at Command._parseCommand ([…]/node_modules/commander/index.js:1503:14)
    at Command._dispatchSubcommand ([…]/node_modules/commander/index.js:1443:18)
    at Command._parseCommand ([…]/node_modules/commander/index.js:1460:12)
    at Command.parse ([…]/node_modules/commander/index.js:1292:10) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'cdk.out/STACK_NAME.assets.template.json'
}
$ DATABASE_URI='postgresql+psycopg2://[email protected]:5432/bde' poetry run cfn-dia html --ci-mode --template-file=cdk.out/STACK_NAME.template.json
$ echo $?
0

Not sure if this should be reported separately.

l0b0 avatar Aug 20 '21 03:08 l0b0

I'm getting the same result

cfn-dia --vers
1.1.33
cdk --version
2.21.1 (build a6ee543)

lewismc avatar Apr 25 '22 03:04 lewismc