You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
In the AWS Lambda function provided in serverless-coffee/backends/6-publisher-service/code/publishToIOT.js , there is an idempotency problem related to the iotPublish API. The code segment publishes a message to the IoT topic using the AWS SDK's iotdata.publish() method. If a failure occurs after the call to iotdata.publish(), subsequent retries of the Lambda function might cause duplicate events to be published, leading to potential issues in downstream systems that are consuming these events.
Steps to reproduce:
Set up the provided Lambda code segment with the necessary environment variables and IoT data endpoint.
Trigger the Lambda function execution by providing a valid event object.
Introduce a failure in the Lambda function execution after the call to iotdata.publish(). This can be simulated through breakpoints or by throwing an exception.
Let the Lambda function automatically retry.
Expected behavior:
The iotdata.publish() call should be idempotent, meaning that if the Lambda function is retried, it should not create duplicate events in the IoT topic.
Actual behavior:
When the Lambda function is retried, it creates duplicate events in the IoT topic, causing potential issues in downstream systems that are consuming these events.
Suggested fix:
Add a unique identifier (e.g., UUID) to the event payload before publishing it to the IoT topic. Then, in the downstream systems that consume these events, implement a deduplication mechanism based on the unique identifier.
By implementing these checks, the Lambda function can ensure idempotent behavior in the face of transient failures and retries.
Thank you for your contribution to the github community and I appreciate your effort in going through this issue.
The text was updated successfully, but these errors were encountered:
NullPointer4096
changed the title
Idempotency issue with putEvents API in OrderProcessorWaitingCompletion.js
Idempotency issue with iotPublish API in publishToIOT.js
Apr 28, 2023
Description:
In the AWS Lambda function provided in serverless-coffee/backends/6-publisher-service/code/publishToIOT.js , there is an idempotency problem related to the iotPublish API. The code segment publishes a message to the IoT topic using the AWS SDK's iotdata.publish() method. If a failure occurs after the call to iotdata.publish(), subsequent retries of the Lambda function might cause duplicate events to be published, leading to potential issues in downstream systems that are consuming these events.
Steps to reproduce:
Expected behavior:
The iotdata.publish() call should be idempotent, meaning that if the Lambda function is retried, it should not create duplicate events in the IoT topic.
Actual behavior:
When the Lambda function is retried, it creates duplicate events in the IoT topic, causing potential issues in downstream systems that are consuming these events.
Suggested fix:
Add a unique identifier (e.g., UUID) to the event payload before publishing it to the IoT topic. Then, in the downstream systems that consume these events, implement a deduplication mechanism based on the unique identifier.
By implementing these checks, the Lambda function can ensure idempotent behavior in the face of transient failures and retries.
Thank you for your contribution to the github community and I appreciate your effort in going through this issue.
The text was updated successfully, but these errors were encountered: