I using a serverless-offline to run AWS-lambda locally on my Mac book. Then I fetch the endpoint to remove 1 user's data. Here is the code:
export const deleteItem = async <T extends BasePersistent>(item: T) => {
const params: AWS.DynamoDB.DocumentClient.DeleteItemInput = {
TableName: process.env.AWS_DYNAMODB_TABLE_NAME!,
Key: {
PK: item.PK,
SK: item.SK,
},
};
const rst = await docClient.delete(params).promise();
return rst;
};
The "rst" is (I don't know why when I copy the "rst", will copy an empty object like {} ):
The rst.$response:
The rst.$response.data:
The rst.$response.request:
After I delete the item, I check the result on the AWS console, and I found the items still there.