Skip to content

ErrorPath not working with States.Format, despite same code working directly via AWS console #596

Open
@benmoveai

Description

@benmoveai

This is a (Bug Report)

Description

States.Format() doesn't seem to work when used in the ErrorPath of a Fail task.

The following state is working as expected in the AWS console:

    "My Fail State": {
      "Type": "Fail",
      "Comment": "The comment.",
      "ErrorPath": "States.Format('job_id: {}, client_id: {}', $[0].detail.job_id, $[0].detail.client_id)",
      "Cause": "A string representing the cause"
    }

however, when translated to yaml we cannot package this - it raises an error.

The following state in yaml does not work with sls package

    My Fail State:
      Type: Fail
      Comment: "The comment."
      ErrorPath: "States.Format('job_id: {}, client_id: {}', $[0].detail.job_id, $[0].detail.client_id)"
      Cause: "A string representing the cause"

When I remove the ErrorPath sls package works correctly.
I cannot remove the double quotes around States.Format i.e.

ErrorPath: States.Format('job_id: {}, client_id: {}', $[0].detail.job_id, $[0].detail.client_id)

because then I get a cannot parse ... bad indentation of a mapping entry... error, presumably because of the curly braces.

I've also tried with:

ErrorPath: "$[0].detail.job_id"

and receive the same error

For bug reports:

  • What went wrong?
    The following error occurs when doing sls package when using an ErrorPath with States.Format()
SCHEMA_VALIDATION_FAILED: /States/Fail - My Fail State. must match exactly one schema in oneOf
  • What did you expect should have happened?
    No error should have occurred

Additional Data

  • The Plugin Version you're using:
    3.17.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions