api gateway and step functions

0

Hi, i've created an Api Gateway that calls a state machine. The problem i have is that when you invoke this service from out you need to specify a stateMachineArn. It seems a lack of security. There's a way to pass it as integration of the request (for example as a constant)? I have tried some solutions as mapping templates but it seems that they does'n work , i always had this error: Value null at 'stateMachineArn' failed to satisfy constraint: Member must not be null" thanks in advance.

2 個答案
1

Value null at 'stateMachineArn' failed to satisfy constraint: Member must not be null"

The same problem raised for me while posting data to DynamoDB table through API Gateway.

How I solved that error: By adding a Body-Mapping template in the Integration Request

In the API > whatever resource > whatever method > Integration Request > Body mapping template, added a new template "application/json" as given below

{ 

    "TableName": "yourTableName",

    "Item": {

        "inputField1": {

            "S": "$input.path('$.tableItemAttribute1')"

            },

        "inputField2": {

            "S": "$input.path('$.tableItemAttribute2')"

            },

        "inputField3": {

            "S": "$input.path('$.tableItemAttribute3')"

            }

    }

}
已回答 1 年前
0

Thank You Anirban for your reply. I've solved too adding a Body-Mapping template in the Integration Request.

{ "input": "$util.escapeJavaScript($input.json('$'))", "stateMachineArn": "arn:aws:MyStateMachine" } it works, you must remember to redeploy the api gateway. Thanks. Dryuyd

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南