YAML aliases in ASL produce unknown errors and break graph rendering
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
## Problem
## Steps to reproduce the issue
1. Create a state machine ASL in YAML like so:
```yaml
StartAt: FirstFunction
States:
FirstFunction:
Type: Task
Resource: ${FirstFunctionArn}
Next: SecondFunction
Retry:
# Suggested transient service exception handler: https://docs.aws.amazon.com/step-functions/latest/dg/bp-lambda-serviceexception.html
- &RetryFunction
ErrorEquals:
- Lambda.ClientExecutionTimeoutException
- Lambda.ServiceException
- Lambda.AWSLambdaException
- Lambda.SdkClientException
IntervalSeconds: 2
MaxAttempts: 6
BackoffRate: 2
SecondFunction:
Type: Task
Resource: ${SecondFunctionArn}
Retry:
- *RetryFunction
End: true
````
3. Open with VS Code and try and display graph. Observe `Errors detected. Cannot preview.` error.
4. Observe no indications in YAML file as which lines or characters may be problematic.
5. Open Problems View. Observe `No problems have been detected in the workspace.`
6. Open Output within Problems View. Observe no output for AWS Toolkit and no relevant logging under AWS Toolkit Logs.
7. Remove the `*RetryFunction` alias (but leave the annchor `&RetryFunction`). Observe the graph immediately updates and starts working.
With some further testing, it seems that CloudFormation doesn't support aliases (https://github.com/aws-cloudformation/cfn-language-discussion/issues/49); trying to deploy this configuration above in JSON form works because the alias is resolved but in YAML form fails with:
``` Invalid State Machine Definition: 'SCHEMA_VALIDATION_FAILED: Expected value of type [OBJECT] at /States/SecondFunction/Retry[0]' (Service: AWSStepFunctions; Status Code: 400; Error Code: InvalidDefinition
```
This is obviously a CFN issue with regards to wider support, but with regards to this issue specifically, the VS Code extension should indicate what the problem is (aliases being unsupported) and ideally highlight the issue in the source code.
## Expected behavior
Unsupported syntax to be highlighted in the source and in the Problems View with an explanation of the issues.
## System details (run the `AWS: About Toolkit` command)
- OS: Darwin arm64 22.5.0
- Visual Studio Code extension host: 1.78.2
- AWS Toolkit: 1.74.0
- node: 16.17.1
- electron: 22.5.2
Contributor guide
Research direction
Reproduce the YAML state machine in VS Code and inspect the AWS Toolkit graph preview, Problems View, and AWS Toolkit logs described in the issue. Trace how the preview handles the anchor and alias, then verify that unsupported aliases are highlighted in the source and reported with an explanation in Problems View.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript, vscode, yaml
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100