'DynamoDB stream triggered lambda not works
There are two DynamoDB tables and two Lambdas. One table is configured with DynamoDB Stream to trigger one of the Lambda, and similarly the other table triggers the other Lambda. However, when changes are made to the tables, only the first Lambda works successfully. The other one is not triggered (no CloudWatch log).
There's no difference with the stream configurations. There's no difference with the insert/update item logic. The only difference is the table schema. The item inserts/updates were all successful.
What could possibly be wrong?
Also if I insert/update the item with AWS console manually, it triggered the second Lambda successfully. The first successful lambda works immediately, while the second lambda works few minutes later.
Code used to insert/update item with boto3:
# insert/update dynamodb item with python boto3
PRODUCT_TABLE.update_item(
Key = {'PRODUCT_NO': 1, 'TYPE': 'a'},
UpdateExpression = "set DATETIME=:DATETIME",
ExpressionAttributeValues = {':DATETIME': '0000-~~'}
)
OPTION_TABLE.update_item(
Key = {'OPTION_NO': 1, 'TYPE': 'a'},
UpdateExpression = "set FLAG1=:FLAG1, FLAG2=:FLAG2",
ExpressionAttributeValues = {':FLAG1': None, ':FLAG2': True}
)
# Table that successfully triggers the Lambda
PRODUCT table
PRODUCT_NO (Number)
TYPE (String)
DATETIME (String)
... several columns
PRODUCT_LOG table
LOG_DATETIME (String)
LOG_TYPE (String)
... same columns with PRODUCT table
# Table that does not successfully triggers the Lambda
OPTION table (there's only 4 columns)
OPTION_NO (Number)
TYPE (String)
FLAG1 (null or not set)
FLAG2 (bool)
OPTION_LOG table
LOG_DATETIME (String)
LOG_TYPE (String)
... same columns with OPTION table
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
