Run a function version by id
const url = 'https://example.com/v1/t/adapters/edge/functions/by-id/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"variables":{"additionalProperty":"example"},"args":{"additionalProperty":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/t/adapters/edge/functions/by-id/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "variables": { "additionalProperty": "example" }, "args": { "additionalProperty": "example" } }'The route the Iris backend uses to run a brick. A failed run (the code
throws, timeout, memory limit) is still 200 with ok: false and
error. Only a missing version and a broken request get another
status.
Permission
This operation needs the permission tenant:scenario_template:manage.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Version id, a UUID
Header Parameters
Section titled “Header Parameters”Names the target tenant.
By principal:
- A tenant-scoped principal may omit it.
- A principal with no tenant of its own names one here.
Refused when:
- A tenant-scoped principal sends a value naming any other tenant.
- A principal with no tenant of its own omits it.
Request Body
Section titled “Request Body”object
Scenario variables. Read in the code with storage.get(key) and
passed to the handler as the second argument.
object
Passed to the handler as the first argument. Iris sends {}.
object
Examplegenerated
{ "variables": { "additionalProperty": "example" }, "args": { "additionalProperty": "example" }}Responses
Section titled “Responses”The run finished. ok: true when the handler returned, ok: false
with error when it threw or the sandbox stopped it.
object
What the handler returned. A string as is, an object or array as
JSON, null and undefined as an empty string, the rest via
String().
Only the keys the run wrote with storage.set, every value as a
string (objects as JSON, null and undefined as an empty string).
Iris writes them back into the scenario variables.
object
console.log lines, cut at 1 KiB with ... [truncated]
console.error lines plus the thrown message, cut at 1 KiB
Present only when ok is false
Milliseconds, including the bundle download
Examples
{ "ok": true, "return": "{\"greeting\":\"Hello, Ann\"}", "variables": { "greeted": "true" }, "stdout": "greeting Ann", "stderr": "", "execution_time": 84}{ "ok": false, "return": "", "variables": {}, "stdout": "", "stderr": "name is required", "error": "name is required", "execution_time": 61}{ "ok": false, "return": "", "variables": {}, "stdout": "", "stderr": "", "error": "Function exceeded timeout", "execution_time": 30004}Domain error. A failed bundle comes as 400 with
err_code: INTERNAL_SERVER_ERROR. On a run route a bundle that could
not be rebuilt is this 400 too.
object
Example
{ "ok": false, "err_code": "UNAUTHORIZED"}Unauthorized
Forbidden
No version with these keys in the account
object
Example
{ "ok": false, "error": "Function not found", "err_code": "NOT_FOUND"}The body, query or path params did not pass the zod schema
object
Zod issues as is
object
Example
{ "ok": false, "error": "Validation failed"}Unexpected error, for example a database or a disk failure. The body
has err_code: INTERNAL_SERVER_ERROR.
object
Example
{ "ok": false, "err_code": "UNAUTHORIZED"}Bad gateway (upstream adapter error)