Wednesday, June 15, 2016

Member must not be null


Error:

Value null at 'tableName' failed to satisfy constraint: Member must not be null;
Value null at 'item' failed to satisfy constraint: Member must not be null"

When:

   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')"
            }
    }
}


2 comments:

  1. We can solve this issue using below code:
    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


    Note:
    Table name is : test_persons
    column name is: First_name

    {
    "TableName": "test_persons",
    "Key": {
    "First_name": {
    "S": "$input.path('$.First_name')"
    }
    }
    }

    ReplyDelete