Can't deploy because of "unrecognized property 'definition'"

Hi there,

when I try to deploy my code via the step functions plug in I get this error:

Warning: Invalid configuration encountered
** at root: unrecognized property ‘definition’**

Learn more about configuration validation here: http://slss.io/configuration-validation

Deploying aws-node-project2 to stage dev (us-east-1)

× Stack aws-node-project2-dev failed to deploy (0s)
Environment: win32, node 18.15.0, framework 3.28.1 (local) 3.28.1v (global), plugin 6.2.3, SDK 4.3.2
Credentials: Local, “default” profile

beforehand I have converted the JSON of the state machine in the workflow builder into yaml:

service: aws-node-project2
frameworkVersion: '3'

provider:
  name: aws
  runtime: nodejs16.x

functions:
  function1:
    handler: index.handler
plugins:
  - serverless-step-functions


stepFunctions:
  stateMachines:
    WorkflowInputOutput:
      name: WorkflowInputOutput

definition:
  StartAt: Get credit limit
  States:
    Get credit limit:
      Type: Task
      Resource: arn:aws:states:::lambda:invoke
      OutputPath: $.Payload
      Parameters:
        FunctionName: >-
          arn:aws:lambda:eu-north-1:409894067074:function:RandomNumberforCredit:$LATEST
      Payload.$: $

    Retry:
      - ErrorEquals:
          - Lambda.ServiceException
          - Lambda.AWSLambdaException
          - Lambda.SdkClientException
          - Lambda.TooManyRequestsException
        IntervalSeconds: 2
        MaxAttempts: 6
        BackoffRate: 2
    Next: Credit applied >= 5000?
  Credit applied >= 5000?:
    Type: Choice
    Choices:
      - Variable: $
        NumericLessThan: 5000
        Next: Auto-approve limit
      - Variable: $
        NumericGreaterThanEquals: 5000
        Next: Wait for human approval
    Default: Wait for human approval
  Wait for human approval:
    Type: Task
    Resource: arn:aws:states:::sns:publish.waitForTaskToken
    Parameters:
      TopicArn: arn:aws:sns:eu-north-1:409894067074:TaskTokenTopic
      Message:
        TaskToken.$: $$.Task.Token
    Next: Credit limit approved
  Credit limit approved:
    Type: Pass
    Next: Verify applicant's identity and address
  Verify applicant's identity and address:
    Type: Parallel
    Branches:
      - StartAt: Verify identity
        States:
          Verify identity:
            Type: Task
            Resource: arn:aws:states:::lambda:invoke
            OutputPath: $.Payload
            Parameters:
              FunctionName: >-
                arn:aws:lambda:eu-north-1:409894067074:function:check-identity:$LATEST
              Payload:
                email: janedoe@example.com
                ssn: 012-00-0000
            Retry:
              - ErrorEquals:
                  - Lambda.ServiceException
                  - Lambda.AWSLambdaException
                  - Lambda.SdkClientException
                  - Lambda.TooManyRequestsException
                IntervalSeconds: 2
                MaxAttempts: 6
                BackoffRate: 2
            End: true
      - StartAt: Verify address
        States:
          Verify address:
            Type: Task
            Resource: arn:aws:states:::lambda:invoke
            OutputPath: $.Payload
            Parameters:
              FunctionName: >-
                arn:aws:lambda:eu-north-1:409894067074:function:check-address:$LATEST
              Payload:
                street: 123 Any St
                city: Any Town
                state: AT
                zip: '01000'
            Retry:
              - ErrorEquals:
                  - Lambda.ServiceException
                  - Lambda.AWSLambdaException
                  - Lambda.SdkClientException
                  - Lambda.TooManyRequestsException
                IntervalSeconds: 2
                MaxAttempts: 6
                BackoffRate: 2
            End: true
    Next: Get list of credit bureaus
  Get list of credit bureaus:
    Type: Task
    Parameters:
      TableName: GetCreditBureau
    Resource: arn:aws:states:::aws-sdk:dynamodb:scan
    Next: Get scores from all credit bureaus
  Get scores from all credit bureaus:
    Type: Map
    ItemProcessor:
      ProcessorConfig:
        Mode: INLINE
      StartAt: Get all scores
      States:
        Get all scores:
          Type: Task
          Resource: arn:aws:states:::lambda:invoke
          OutputPath: $.Payload
          Parameters:
            FunctionName: >-
              arn:aws:lambda:eu-north-1:409894067074:function:get-credit-score:$LATEST
          Retry:
            - ErrorEquals:
                - Lambda.ServiceException
                - Lambda.AWSLambdaException
                - Lambda.SdkClientException
                - Lambda.TooManyRequestsException
              IntervalSeconds: 2
              MaxAttempts: 6
              BackoffRate: 2
          End: true
    End: true
    ItemsPath: $.Items
  Auto-approve limit:
    Type: Pass
    Next: Verify applicant's identity and address

Can you help a noob like me? :slight_smile:

1 Like