I've got an AWS
Lambda function I've written in Java (well, it's actually written in Clojure) and it appears to get invoked 3 times every time I run it.
My function runs successfully and well within the timeout (which is set to the max of 5 minutes). It returns a string which I can see output when I test the function in the console.
I've seen some stuff online about having to call some Context success / done function but can't see that in the Java SDK (seems to be for Node only?).
Am I missing something?
This does not occur when I click test in the console (it only runs once) but does happen when triggered via a CloudWatch Trigger or running via the AWS SDK.
Thanks,
Donovan
Update: apologies, this does not happen when running via the trigger, only via the SDK and CLI, so perhaps there is some timeout in the call I am making.
For future reference for anyone else, the issue was the SDK and CLI hitting the read timeout of one minute and then retrying the request. I manually set this to 5 minutes to match my AWS Lambda timeout.
This can be done in the CLI by adding --cli-read-timeout int
where int
is your desired timeout (or simply --cli-read-timeout 0
which disables the timeout altogether).
In the Java SDK it can be done by calling setSocketTimeout(int socketTimeout)
on the ClientConfiguration
object
In Clojure using Amazonica, add :client-config {:socket-timeout xxx}
to your credentials map.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With