How to write item, with Null attribute, to Dynamodb through BatchWriteItem task in AWS Step function

0

I am attempting to use aws step functions with the batchwriteitem task for dynamodb.

Unfortunately, the step function throws an error suggesting "The field "NULL" is not supported by Step Functions". But this is how AWS SDK documentation suggests we label null values in API call. If the "NULL" value isn't expected, then how am I supposed to write an item, that has a Null attribute, to Dynamodb through BatchWriteItem task in AWS Step functions

Example task in Step function which is causing step function ASL error. I tried changing "NULL" to "Null" or "null". And none of these work?

"BatchWriteItem": {
    "Type": "Task",
    "End": true,
    "Parameters": {
        "RequestItems": {
            "sample-dynamodb-table": [
                {
                    "PutRequest": {
                        "Item": {
                            "PK": {
                                "S": "trash"
                            },
                            "SK": {
                                "S": "trash"
                            },
                            "value": {
                                "NULL": true
                            }
                        }
                    }
                }
            ]
        }
    },
    "Resource": "arn:aws:states:::aws-sdk:dynamodb:batchWriteItem"
}
1개 답변
2
수락된 답변

Its a little bit funny, but its based on Java SDK V2 AttributeValue and should be set as Nul.

"BatchWriteItem": {
    "Type": "Task",
    "End": true,
    "Parameters": {
        "RequestItems": {
            "sample-dynamodb-table": [
                {
                    "PutRequest": {
                        "Item": {
                            "PK": {
                                "S": "trash"
                            },
                            "SK": {
                                "S": "trash"
                            },
                            "value": {
                                "Nul": true
                            }
                        }
                    }
                }
            ]
        }
    },
    "Resource": "arn:aws:states:::aws-sdk:dynamodb:batchWriteItem"
}
profile pictureAWS
전문가
답변함 일 년 전
profile pictureAWS
전문가
검토됨 일 년 전
  • Ah wow Thank you! Where might I have found this? I had been searching for a while. Is this documented in step function ASL docs anywhere? Or maybe somewhere else?

  • I don't believe its documented, it was something I discovered recently myself. I will bring it up with the documentation team to highlight this. Same scenario occurs for other attributes with step functions following pascal casing, for example string sets which are normally SS are defined in StepFunctions as Ss.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠