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 Risposta
2
Risposta accettata

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
ESPERTO
con risposta un anno fa
profile pictureAWS
ESPERTO
verificato un anno fa
  • 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.

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande