Skip to content

State machine definition does not support JSONata #637

@villagoizi

Description

@villagoizi

Does not support JSONata

Description
In this line of code it expects a state.Parameters but when you use JSONata everything changes from Parameters to Arguments.

const functionName = state.Parameters.FunctionName;

You get the following exception when performing an sls deploy:
TypeError: Cannot read properties of undefined (reading 'FunctionName')

This is the definition used

Comment: Validate
StartAt: input validation
QueryLanguage: JSONata
States:
  input validation:
    Type: Task
    Resource: arn:aws:states:::lambda:invoke
    Output: '{% $states.result.Payload %}'
    Assign:
      command: '{% $merge([$states.input.params.path, $states.input.body]) %}'
      meta: '{% $states.input %}'
    Arguments:
      FunctionName:
        'Fn::GetAtt':
          - ValidatorLambda
          - Arn
      Payload:
        rule: ${file(src/model-config/schemas/update.yml)}
        payload: '{% $merge([$states.input.params.path, $states.input.body]) %}'
    Retry:
      - ErrorEquals:
          - States.ALL
        IntervalSeconds: 1
        MaxAttempts: 2
        BackoffRate: 1
        JitterStrategy: FULL
    End: true

Additional data

  • Serverless Framework Core Version you're using: ^3
  • The Plugin Version you're using: ^3.21.1
  • Operating System: Linux

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