Step Function = Unsupported Media Type when calling http

api-gateway
#1

I want to trigger my step function by http event to api gateway. I’m sending content-type application/json to seed some data in the first function, but when I call https://…amazonaws.com/dev/hello returns the message Unsupported Media Type. What am I missing in my yaml to not support content-type application/json?

service: my-step-functions

custom:
  stage: ${opt:stage, 'dev'}

plugins:
  - serverless-offline
  - serverless-step-functions
  - serverless-pseudo-parameters

provider:
  name: aws
  runtime: nodejs8.10
  stage: ${self:custom.stage}
  region: us-east-1

  iamRoleStatements:
    - Effect: "Allow"
      Action:
        - "states:*"
      Resource:
        - "*"

functions:

  hello:
    handler: handler.hello
  testNextFunction:
    handler: handler.testNextFunction

stepFunctions:
  stateMachines:
    hello:
      events:
        - http:
            path: hello
            method: POST
            cors: true
      name: hello
      definition:
        Comment: A hello world example
        StartAt: HelloWorld
        States:
          HelloWorld:
            Type: Task
            Resource: "arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:#{AWS::StackName}-hello"
            Next: testNextFunction
          testNextFunction:
            Type: Task
            Resource: "arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:#{AWS::StackName}-testNextFunction"
            End: true
0 Likes

#2

Hi, at the first glance everything looks fine, but there are a lot of hellos here :slight_smile: you have a hello function, hello state machine… I would try to change all hello names, maybe there is some kind of conflict.

0 Likes