Hello everyone…
Quick question here… Is there a way for a lambda function to know if it was invoked synchronously (RequestResponse) or async (Event) inside the lambda code?
Thanks
Hello everyone…
Quick question here… Is there a way for a lambda function to know if it was invoked synchronously (RequestResponse) or async (Event) inside the lambda code?
Thanks
You could possibly rely on the ClientContext
object in the context object passed to the handler.
You can invoke a function synchronously (and wait for the response), or asynchronously. By default, Lambda invokes your function synchronously (i.e. the
InvocationType
isRequestResponse
). To invoke a function asynchronously, setInvocationType
toEvent
. Lambda passes theClientContext
object to your function for synchronous invocations only.
Lack of a client context could mean it’s async, but I’m not sure how reliable that is.
I have a little code that looks at the shape of the request and can discern between the different event types I support (API Gateway, SNS, SQS)
is that code public?