DEV Community

Discussion on: Serverless Framework ️<3 AWS CDK

Collapse
 
louispinsard profile image
Louis Pinsard

Hello Frédéric ! Great article !

While trying to integrate CDK with Serverless framework I am facing an issue with certain resources.
CDK creates cloudformation parameters with no default value.
I added the Parameters key in serverless.ts just like for the Resources key (app.synth().getStackByName(stack.stackName).template.Parameters) but I get an error "Parameters must have values" while deploying.

Did you face similar issue ?

Collapse
 
fredericbarthelet profile image
Frédéric Barthelet

Thanks Louis :) !

Indeed, CDK v2 synthetizer now implements a few checks that translates in CloudFormation instructions. This article was written with v1 in mind.
One of the check CDK performs in v2 is the version of the bootstrap stack it relies on in normal CDK usage, through CloudFormation parameters - those missing in your case. One way to overcome this is to disable such check by overriding CDK v2 synthetizer as described below :

const app = new App();
const stack = new Stack(app, undefined, {
    synthesizer: new DefaultStackSynthesizer({
        generateBootstrapVersionRule: false,
    });
Enter fullscreen mode Exit fullscreen mode

I'll update the article to reflect this change now that v2 is more popular than v1. Thanks for pointing that out !