aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

[aws-stepfunctions] JsonPath does not support path with array: $[0]

Open clementy28 opened this issue 6 years ago • 1 comments

Caused by:

software.amazon.jsii.JsiiException: JSON path values must be exactly '$', '$$', start with '$.' or start with '$$.' Received: $[0].source.bucket
Error: JSON path values must be exactly '$', '$$', start with '$.' or start with '$$.' Received: $[0].source.bucket

Reproduction Steps

    private List<TaskEnvironmentVariable> environment() {
        return List.of(
                env("source_bucket", JsonPath.stringAt("$[0].source.bucket")),
                env("source_region", JsonPath.stringAt("$[0].source.region")),
                env("target_bucket", JsonPath.stringAt("$[0].target.bucket")),
                env("target_region", JsonPath.stringAt("$[0].target.region")),
                env("stream_name", JsonPath.stringAt("$[0].stream")),
                env("stream_region", JsonPath.stringAt("$[0].target.region")),
                env("credential_id", JsonPath.stringAt("$[0].source_credential_id")),
                env("token", JsonPath.getTaskToken()));
    }

Error Log

Caused by:

software.amazon.jsii.JsiiException: JSON path values must be exactly '$', '$$', start with '$.' or start with '$$.' Received: $[0].source.bucket
Error: JSON path values must be exactly '$', '$$', start with '$.' or start with '$$.' Received: $[0].source.bucket

Environment

  • CLI Version : 2
  • Framework Version: 1.56
  • Node.js Version:
  • OS : Darwin
  • Language (Version): Java 11

Other


This is :bug: Bug Report

clementy28 avatar Aug 03 '20 01:08 clementy28

for any interested contributors: code change to make is to loosen the validation (and add a test!)

shivlaks avatar Aug 04 '20 17:08 shivlaks