aws_lambda_invoke
Invoke a Lambda function synchronously and get its response payload plus decoded execution log tail in one call, eliminating separate log retrieval steps.
Instructions
Invoke a Lambda function synchronously (RequestResponse) and return its response payload plus the DECODED tail of its execution log in one call. Use this instead of aws_call for Lambda invokes: aws lambda invoke needs a positional output file and rejects --cli-input-json, so aws_call structurally cannot reach it. The returned logTail is the last ~4 KB of the function's own log output, already base64-decoded, which removes the usual invoke -> find the log group -> tail it -> hope the window caught it loop. Functions on Lambda Managed Instances do not support the log tail; read their logs with aws_logs_tail. IMPORTANT: a non-empty functionError means the function's HANDLER threw; the invocation itself still succeeded, so ok is true and the thrown error is in payload. The invoke is sent AT MOST ONCE: the AWS CLI's automatic retries are turned off here, because a retried invoke runs the function again. A TooManyRequestsException, or a connection that could not be opened, means nothing ran, so retrying is safe. On errorKind 'timeout' the error says whether the invoke was sent; if it was, or after a dropped connection or a 5xx, the function may have run and may still be running -- check its logs before invoking again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| region | No | Override session region for this call. | |
| payload | No | The event to pass to the function. Any JSON value (usually an object); it is JSON-encoded and sent as the request body. Omit for a function that takes no input — this sends no payload at all rather than an empty object. | |
| profile | No | Override session profile for this call. | |
| qualifier | No | Version number or alias to invoke, e.g. '3' or 'PROD'. Omit for the service default: $LATEST for a standard function, $LATEST.PUBLISHED for one on Lambda Managed Instances. Durable functions need an explicit qualifier (a version, an alias, or $LATEST). | |
| timeoutMs | No | How long to wait for the function to respond, in milliseconds. Default 60000. Set it to at least the function's own configured timeout; a synchronous invoke runs at most 15 minutes, so values above 900000 are treated as 900000. The AWS CLI is allowed 10 s beyond this to cover a cold start, so a function that hits its own timeout still returns as a functionError with its log tail; a call that gets no answer at all fails with errorKind 'timeout' after at most timeoutMs + 15 s. | |
| functionName | Yes | Function name, name:alias, partial ARN ('123456789012:function:my-fn'), or full ARN. E.g. 'my-function', 'my-function:PROD'. | |
| invocationType | No | Only 'RequestResponse' (synchronous) is supported. Async 'Event' and permission-check 'DryRun' are deliberately not implemented — 'Event' returns no payload or logs and needs its own result shape. For a pre-flight permission check, aws_iam_simulate evaluates the caller's identity policies but not the function's resource-based policy. |