Cloud Function HTTP Job

The Cloud Function HTTP job type invokes an HTTP-triggered Google Cloud Function (both 1st gen and 2nd gen) by calling its public URL with an OIDC identity token. The function is identified by its full resource name — Polysync stores projects/{project}/locations/{location}/functions/{functionName} in the Job's External Id.

This job type is supported on the Google Cloud Functions platform.

Required job fields

  • External Id — the function's full resource name.
  • Job TypeCloud Function HTTP (set automatically on import).
  • HTTP Method — job attribute, defaults to POST. Determines where Polysync parameters are placed.

Job discovery

GET projects/{project}/locations/{location}/functions?pageSize=100

(Cloud Functions v2 API, paginated). Only HTTP-triggered functions are imported; event-triggered functions are excluded. The function's public URL is captured from serviceConfig.uri.

Parameter handling

HTTP Method Where parameters go
GET / HEAD / DELETE Query string
POST / PUT / PATCH JSON body

Values are typed via the Polysync Data Type and rendered as JSON tokens (string, number, bool, JSON object, JSON array).

Direction Sent in request Updated from response
Input
Output
Input&Output

The Authorization header is set to a Bearer OIDC identity token whose audience is the function URL host — Cloud Run / Cloud Functions enforces invoker IAM via this token.

Output parameters

The response body is parsed as JSON:

  • For each Polysync Output / Input&Output parameter whose name matches a top-level response property, that value is written back.
  • Non-matching top-level response properties are stored under _response.<fieldName>.
  • If the response isn't JSON, the body is stored under _response (truncated to 1000 characters).

If the response contains a statusQueryUrl, Polysync uses it to poll for long-running function status (re-running the output extraction on each poll).

Execution flow

  1. Polysync issues the configured HTTP method against serviceConfig.uri with the assembled body / query string and an OIDC bearer token.
  2. HTTP 2xxSuccess (and outputs populated). HTTP 202 with statusQueryUrlRunning (polled). HTTP 4xx / 5xxFailed.
  3. Cancel is not supported — HTTP invocations cannot be cancelled once started.

The composite RunId is "{functionName}/{invocationId}" (a Polysync GUID).

Monitor URL

https://console.cloud.google.com/functions/details/{location}/{functionName}
  ?project={project}

Best practices

  • Grant the runtime identity the Cloud Run Invoker role (2nd gen) or Cloud Functions Invoker (1st gen) on the function.
  • For long-running work, return 202 Accepted with { "statusQueryUrl": "…" } so Polysync polls cleanly instead of timing out the synchronous call.
  • Always return JSON from the function (Content-Type: application/json) so output parameter extraction works.

Troubleshooting

  • HTTP 401 / 403 — the runtime identity lacks invoker IAM. Grant Cloud Run Invoker (or Cloud Functions Invoker for 1st gen) on the function and verify token audience matches the URL host.
  • Output parameter empty — response wasn't JSON, the top-level property name didn't match (case-sensitive), or HTTP status was not 2xx. Check _response for the raw body.