aws / aws-toolkit-vscode

Amazon Q, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode
Apache License 2.0
1.41k stars 348 forks source link

"Render state machine graph from CDK application" always fails #4561

Open anentropic opened 3 months ago

anentropic commented 3 months ago

Problem

I have defined two Step Functions state machines in my CDK (Python) application.

When I try to use the render option the preview panel opens but with this error:

Errors detected. Cannot preview.

Steps to reproduce the issue

Open my project then either use the AWS browser and click preview icon:

Screenshot 2024-03-20 at 14 59 30

or Cmd+Shift+P and select "AWS: Render state machine graph from CDK application"

Expected behavior

See a graph

System details (run the AWS: About Toolkit command)

wong-a commented 3 months ago

Can you share an example the CDK code causing errors? Is this happening for any CDK generated state machines or just some?

wong-a commented 3 months ago

Unable to reproduce using the python cdk example here: https://github.com/aws-samples/aws-cdk-examples/tree/master/python/stepfunctions

Even after updating the dependency of aws-cdk-lib to the latest version (2.133.0) I am able to visualize the state machine. Maybe the generated definition is invalid, or the extension is unable to parse certain construct generated ASL.

oceanofmaya commented 1 month ago

In my case, it occurs only for some state machines. My CDK application's state machine deploys fine and all is good in AWS console when viewing definition and there are no issues with its executions. Rendering in the IDE fails with the same error as reported in this GH issue. The one that fails has more steps than the other one that succeeds in rendering and has a distributed map, other than that I don't have any major differences.

oceanofmaya commented 1 month ago

If I render the same state machine that has been deployed using the extension, it works fine. So, it appears to have an issue rendering some state machines from a CDK application using the synthesized template json.