Idempotency #2158
-
Hey there I'm building a lambda function with a REST API event handler and My question is regarding the decorator. Is there any way to for the client to distinguish between a cached response from the lambda and a non cached response ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
hey @royassis, thank you for starting a discussion :) Could you share more on what is your intent? As in, why do you need to distinguish a saved response if the request was retried with the exact same parameters (e.g., idempotent)? Generally speaking, you wouldn't need to do that since it's the exact same request sent. There could be a need to add custom header in that regard which is where I guess is where you're coming from ( If you prefer a chat, please join us on Discord: https://discord.gg/B8zZKbbyET Looking forward to hearing more from you on this. Thank you |
Beta Was this translation helpful? Give feedback.
-
Hey @heitorlessa! I'll explain our use case. We have a client-server web application. We want to prevent cases where a duplicated message is sent to the backend and triggers the pipeline multiple time. And yes, the header, is exactly what I mean. A hook for changing the response (e.g. adding a field) was also in mind. Best, p.s I'm having some joining with the Discord link. |
Beta Was this translation helpful? Give feedback.
UPDATE: Feature request: #2164
Ah that makes sense - when you can, please create a feature request along with an idea for how you'd like to use this feature and we can look into it ;)
Because the response is exactly the same given the same idempotency key, I wonder what would be an ergonomic way to record and expose that information to the caller. In the worst case, if we can't think of anything generic enough for many use cases, we can make a tighter integration with Event Handler so it also handles the header return for you automatically (you can customize, of course ;)).
PS: Love when these discussions happen. One area we'd love to investigate is creating operational metrics for many o…