I have a CDK application where I am getting context values, like:
const stage: StageType = app.node.tryGetContext('stage');
I followed the JetBrains documentation for setting a run configuration using ts-node, however context is created by the CDK CLI. My code fails to run with the necessary context values.
Is there a way to debug, using using the CDK CLI to start the application?
I've had the same issue recently and just discovered a way to debug the CDK command via WebStorm.
Rather than debugging via node debug via npm. In my package.json I have a script of cdk that simply runs cdk (I think this is standard with the CDK?).
Then for the WebStorm configuration, use the run command, and the cdk script. In arguments you can now pass synth -- -c stage='myStageContext'

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With