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.

cdktf deploy fails with "Unexpected token c in JSON at position 1"

See original GitHub issue

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave “+1” or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

cdktf & Language Versions

"@cdktf/provider-aws": "^7.0.20",
"cdktf": "^0.10.1",
"cdktf-cli": "^0.10.1",

Terraform v1.1.8

Affected Resource(s)

Debug Output

Before cdktf plan is executed:

Debug Information:
    Terraform CDK version: 0.10.1
    Terraform version: Unknown: Error loading terraform version SyntaxError: Unexpected token c in JSON at position 1

After the plan JSON is generated:

[2022-04-19T14:44:36.026] [DEBUG] default - ::debug::Terraform exited with code 0.

Unexpected token c in JSON at position 1
[2022-04-19T14:44:36.029] [DEBUG] default - [my-stack]: errored

Expected Behavior

Stack deploys

Actual Behavior

The cdktf plan generates the JSON correctly and exists with exit code 0. However after that whatever comes next after plan (I assume it’s apply) fails with error: Unexpected token c in JSON at position 1 with no stack trace.

Steps to Reproduce

Important Factoids

Fails on GH Actions, works locally.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ansgarmcommented, Apr 19, 2022

Hi @mbaranovski,

are you using the setup-terraform Github Action? If yes, maybe you’re running into this issue: https://github.com/hashicorp/terraform-cdk/issues/1020

1reaction
mbaranovskicommented, Apr 19, 2022

That was the case! Thanks @ansgarm & @DanielMSchmidt

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected token error with cdk deploy on an existing stack ...
Describe the bug Hi I've an existing stack project written in Java. So far I've been deploying it using cdk deploy command and...
Read more >
SyntaxError: Unexpected token C in JSON at position 0
I was facing the exactly issue. Just change: error.json(). to. JSON.parse(JSON.stringify(error)).
Read more >
Guide to fix “unexpected token o in json at position 1” error
The “unexpected token o in json at position 1” appears because of parsing an already parsed object. Read this article to learn more...
Read more >
How to fix Unexpected Token in JSON error (for ... - YouTube
Not a programmer? Read this! ** - If you get this error in an app you didn't make, and/or you're not a web...
Read more >
Unexpected token o in json at position 1 error – How to fix it
Unexpected token o in json at position 1 error – How to fix itFollow me on Instagram: https://www.instagram.com/noeldemoses/Visit my channel ...
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