-
Notifications
You must be signed in to change notification settings - Fork 154
Bug: makeFunctionIdempotent
wrapper requires payload property matching dataKeywordArgument
#1574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @brnkrygs thank you for reporting this, we'll be taking a closer look and get back to you here. |
Hi Brian, thank you again for reporting this. As a result of this feedback, as well as the others you have shared, we have decided to change the API and remove the The full detailed explanation of why we made this change can be found in the PR body of #1579 (section titled At a high level, we realized that The main function of With this in mind, and considering that JavaScript doesn't have a notion of keyword arguments, we have decided to replace the option with a more aptly named This can be used in conjunction with the Let me know if this helps, it'd be amazing if you could try the same implementation with the new logic and let me know if it fixes the issue (I can provide a build if needed, just ping me). |
Thanks for your effort on this @dreamorosi, I would love to take another run at the new implementation. I have a set of tests I want to run against it 😄 Will ping you about a build. |
The new build is looking good! No more exceptions about the |
|
Expected Behaviour
When I use the Function Wrapper pattern with the
makeFunctionIdempotent
function, thedataKeywordArgument
should be used to determine which of the arguments of my wrapped function to use for the data payload logged in the idempotency persistence mechanism.With this setup, I should be able to send a payload to my function with any JSON structure and have the idempotency mechanism run successfully.
Current Behaviour
When I send a payload that does not include a property in the root of the input that matches
dataKeywordArgument
, I get an error:Code snippet
Lambda handler function initialized by
sam init
using Hello World template, TypeScriptInvoke that works
Notice property that matches
dataKeywordArgument
in samplesam remote invoke --event '{"payload":"abc124"}'
Invoke that fails
sam remote invoke --event '{"something_else":"thing"}'
Steps to Reproduce
dataKeywordArgument
to"payload"
. Lambda initialized withsam init
using TypeScript Hello World template.sam remote invoke
or use the Lambda test console to send a invoke payload that does not include a property named"payload"
, I get an Error.sam remote invoke
or use the Lambda test console to send an invoke payload that includes a property named"payload"
in the root of the JSON, it works.Error:
Failed to save record in progress. This error was caused by: The \"data\" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined.
Possible Solution
No response
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
18.x
Packaging format used
npm
Execution logs
Success
The text was updated successfully, but these errors were encountered: