aws / aws/aws-cdk

Template error: Fn::Select cannot select nonexistent value at index...

Open
#30,308 4 comments 1 reaction 0 assignees View on GitHub
@aws-cdk/core effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Currently when applying [template ](https://github.com/SolaceProducts/pubsubplus-aws-ha-quickstart/blob/master/templates/solace.template) which is using functions like !Select we may have an error like this:

```
ERROR 2024-05-22 16:14:18 Unexpected error:
ERROR 2024-05-22 16:14:18 An error occurred (ValidationError) when calling the CreateStack operation: Template error: Fn::Select cannot select nonexistent value at index 2
ERROR 2024-05-22 16:14:18 CommandExecution failed with exit code: (1)
```

This is not clear what is going wrong here. We have a large template and it would be great if cdk would print more informative message pointing to the exact place in the file causing the error.

Do you think it's possible? Thanks!

### Use Case

Applying published template from yaml file using functions like !Select

### Proposed Solution

Printing line number of the template file for the failed function would be already enough. Ideally there must be some debug/trace feature allowing us to debug template execution.

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.142.1 (build ed4e152)

### Environment details (OS name and version, etc.)

Ubuntu 23.10

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with the published templates/solace.template file and its !Select usage on CDK 2.142.1. Trace how the current ValidationError is surfaced during template application, then define the smallest diagnostic result that identifies the failing template location; done means the error reports the relevant line or provides the proposed debugging trace.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.