-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Hi,
When I execute a cdk diff on my CDK project to get differences with an existing CloudFormation template (that was not initially generated by this project). In fact, it's failing with some stacks and not all of them.
It's really hard to define why as we have no information one the root cause.
I have use the debug mode and verbose mode to have more information, and it's not really helpful.
Reproduction Steps
My initial code :
const mainStackName: string = "my-stack-01";
const mainStack = new MyLoaderStack(app, mainStackName, {
env: {
region: buildConfig.awsProfileRegion,
account: buildConfig.awsAccountID
}
}, buildConfig);If mainStackName is a CloudFormation that is not existing, it's working in all case, if it exists, it fails for some of them but with a difficult reason to guess...
What actually happened?
For the CloudFormation that are not working well I have this output:
Stack my-stack-01
Reading existing template for stack my-stack-01.
Unexpected token A in JSON at position 0
SyntaxError: Unexpected token A in JSON at position 0
at JSON.parse (<anonymous>)
at Object.deserializeStructure (C:\Users\XXXX\AppData\Roaming\npm\node_modules\aws-cdk\lib\serialize.ts:19:17)
at CloudFormationStack.template (C:\Users\XXXX\AppData\Roaming\npm\node_modules\aws-cdk\lib\api\util\cloudformation.ts:70:50)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at CdkToolkit.diff (C:\Users\XXXXX\AppData\Roaming\npm\node_modules\aws-cdk\lib\cdk-toolkit.ts:104:33)
at initCommandLine (C:\Users\XXXXX\AppData\Roaming\npm\node_modules\aws-cdk\bin\cdk.ts:213:9)
If I made a test with a stack "my-stack-02", that also exist (ie. already deployed on my AWS account like my-stack-01), it's working well. But as I don't understand this error and what could be wrong.
I checked the remote CloudFormation templates, but I guess if their format was not correct, they will not be deployed on AWS CloudFormation...
Environment
- **CDK CLI Version : 1.116.0
- **Framework Version: 1.116.0
- **Node.js Version: v14.17.4
- **OS : Windows 10
- **Language (Version): TypeScript 3.9.7
Other
aws synth is working as expected.
This is 🐛 Bug Report