question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

app-delivery expects yaml output, but cdk synth only outputs json

See original GitHub issue

I’d like to report a simple bug in the app-delivery module. I’m trying to use the app-deploy module to build and self-deploy a CDK app, just like in the documentation. The problem is that the app-deploy model expects the built CFN to be in yaml format (see https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/app-delivery/lib/pipeline-deploy-stack-action.ts#L123), but running node_modules/.bin/cdk synth -o dist will only produce json output, no matter what options you supply.

The only way I’ve been able work around the problem is to do a dodgey content redirect in the buildspec.yml file

  # When redirecting, the directory must exist before the command is run.
  # TODO remove when cdk bug is resolved.
  - mkdir -p dist

  # There is a bug in CDK whereby the cdk command generates json when using the 
  # -o option, but the app-deploy target expects yaml.  To work around this, we
  # do silly buggers with redirection of the stdout, which is yaml.
  - node_modules/.bin/cdk synth -o dist > dist/CodepipelineMetaStack.template.yaml

Whilst this makes it work, it isn’t very elegant and its prone to output changes in the cdk executable. Its trivial to fix, so I thought I’d raise this issue.

This is related to https://github.com/aws/aws-cdk/issues/2965 in that fixing that one would allow me to create a yaml file as part of a call to cdk synth. You could either fix that bug, or change the linked file to expect json instead…

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
eklinkhammercommented, Sep 8, 2019

As a short term fix, I added this to my buildspec: - find dist/ -name '*.template.json' -exec rename 's/\.json$/.yaml/' \{} \;

0reactions
eladbcommented, Aug 13, 2019

Got it. Confirming this is a bug in the app-delivery library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting common AWS CDK issues
When deploying my AWS CDK stack, I receive a NoSuchBucket error ... Availability Zones for my Auto Scaling group or VPC, but it...
Read more >
awslabs/aws-cdk - Gitter
I've had opinions about workflows, because we have to do a lot of deploying in stages and non-CDK operations during synth. Gonna try...
Read more >
sst-cdk - npm
cdk synth, Synthesize a CDK app to CloudFormation template(s) ... stack including all details (add --json to output JSON instead of YAML).
Read more >
@aws-cdk/aws-lambda-nodejs | Yarn - Package Manager
The CDK Construct Library for AWS Lambda in Node.js ... This results in smaller Lambda packages that contain only the code and dependencies...
Read more >
awscdk - Go Packages
RuntimeInfo *bool `field:"optional" json:"runtimeInfo" yaml:"runtimeInfo"` // Include construct creation stack trace in the `aws:cdk:trace` metadata key of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found