AWS Lambda Function Job

The AWS Lambda Function job type invokes an AWS Lambda function via Invoke, sending a JSON event payload built from Polysync parameters and (for synchronous invocations) parsing output parameters from the response. The function is identified by its name — Polysync stores that in the Job's External Id.

This job type is supported on the AWS Lambda platform.

Required job fields

  • External Id — the AWS Lambda function name.
  • Job TypeAWS Lambda Function (set automatically on import).

Job attributes (optional; override platform defaults):

  • Lambda Invocation TypeEvent (async, fire-and-forget), RequestResponse (sync, default), or DryRun (validation only).
  • Lambda Qualifier — a function version number or alias name (e.g., PROD, 1). Omit to invoke $LATEST.

Precedence: job override → platform default → RequestResponse, no qualifier.

Job discovery

ListFunctions (paginated via Marker, MaxItems=50). No parameters are auto-imported — Lambda has no formal event-schema declaration, and function environment variables are deliberately not surfaced (they are visible to function code only, never sent in the invocation event). Define the event-payload parameters manually on the Job after import.

Parameter handling

Polysync builds a single JSON object event payload, with each Polysync parameter as a top-level property:

{
  "<param-1>": <typed-value>,
  "<param-2>": <typed-value>
}
Direction Sent in payload Updated from response
Input (RequestResponse only)
Output (RequestResponse only)
Input&Output (RequestResponse only)

Polysync honours the declared Data Type when serialising:

  • boolean → JSON true/false
  • int / long / number / decimal / double / float → JSON number
  • json / object / array → emitted as raw JSON if valid, else string
  • everything else → JSON string

A heuristic also treats values starting and ending with {} or [] as raw JSON.

Output parameters

Only RequestResponse invocations populate output parameters. On HTTP 200 with no FunctionError:

  • The response Payload is parsed as JSON.
  • For every parameter whose Direction is Output or Input&Output, Polysync looks for a case-insensitive match on the top-level property name in the response object.
  • The response root must be a JSON object — raw strings, numbers, or arrays at the root do not populate outputs.

Example:

def lambda_handler(event, context):
    cid = event["customerId"]
    return {"customerId": cid, "score": compute(cid)}
Parameter Data Type Direction
customerId String Input&Output
score Int Output

Execution flow

  1. Polysync resolves invocation type + qualifier, builds the event payload, and calls Invoke(FunctionName, InvocationType, Payload, Qualifier).

  2. Status is decided synchronously from the AWS response — Lambda has no GetInvocation API, so the status is encoded into the RunId and later decoded by status polling:

    Invocation Type AWS response Polysync status
    RequestResponse HTTP 200 + no FunctionError Success
    RequestResponse FunctionError set or non-200 Failed
    Event HTTP 202 Accepted Success
    Event non-202 Failed
    DryRun HTTP 204 No Content Success
    DryRun non-204 Failed
  3. The composite RunId is "{functionName}/{awsRequestId}#{status}".

  4. Cancel is not supported — Lambda has no API to cancel an in-flight invocation.

Monitor URL

https://{region}.console.aws.amazon.com/lambda/home?region={region}
  #/functions/{functionName}?tab=monitoring

For Event invocations the monitoring tab is the primary way to confirm execution outcomes (CloudWatch Logs + invocation metrics).

Best practices

  • Define each event-payload field as a Polysync parameter with an explicit Data Type — that drives correct JSON token emission.
  • For long-running work, return early from the handler and persist results to S3 / DynamoDB; pass references back via Polysync output parameters.
  • Lambda's synchronous payload limit is 6 MB request / 6 MB response — for larger data, write to S3 from the function and pass only object keys through parameters.

Troubleshooting

  • AccessDeniedException on InvokeFunction — the caller is missing lambda:InvokeFunction on arn:aws:lambda:{region}:{account}:function:{functionName}.
  • ResourceNotFoundException — verify the function name and qualifier in the target region.
  • Handled / Unhandled FunctionError — the function returned a runtime error. CloudWatch Logs has the full stack trace.
  • Output parameters not populated — confirm invocation type is RequestResponse, the response is a JSON object at the root, the parameter Direction is Output / Input&Output, and the property name matches (case-insensitive).