Server.call
luastra/serverServer.call(operation: string, input: { [string]: string }, options: Options?): RequestIdStarts a versioned request to a trusted backend operation with a bounded string map and optional request settings, returning a RequestId. Server authentication, authorization, validation, and secrets remain outside client Luau.
Before you use it
Add luastra/server to this module's dependencies in luastra.json, then import it with require("luastra/server"). Declare rpc.call in luastra.json and configure a declared backend operation with a deployed trusted handler. Application code should prefer its generated operation function and decoder.
How it fits
Server.call starts asynchronous trusted work; app.resolve later reports transport success or failure.
When to use it
Use Server.call for declared backend work that cannot safely or reliably run in the client, such as privileged data access. Track the RequestId, handle transport failure in app.resolve, and validate successful payloads before use.
Parameters
| Parameter | Type / values | Description |
|---|---|---|
| operation | string | Declared, versioned backend operation name. |
| input | { [string]: string } | Bounded string map sent as operation input; never include client-side secrets. |
| options | Options? | Optional deadline and retry policy for the request. |
| options.deadlineMs | integer (1..30000)? | Optional request deadline; defaults to 3000 ms. |
| options.idempotencyKey | string (8..128 bytes)? | Optional stable idempotency key for operations that may be retried. |
| options.retry | boolean? | Allows the host's bounded retry policy when true; defaults to false. |
Returns
RequestId — an opaque request identifier used to correlate the asynchronous completion in app.resolve.
What happens next
A RequestId now, then one resolve completion from the configured backend.
Failures and fixes
Handle transport failure, envelope decode failure, and domain validation failure separately. The static web build does not deploy trusted backend handlers, credentials, or production operations for you.
Availability
Public-source alpha API in 0.5.0-alpha; production backend deployment remains application-owned.
Focused example
local Server = require("luastra/server")
local requestId = Server.call("records.list.v1", { cursor = "" }, { deadlineMs = 3000, retry = true })Continue with a complete recipe
This checked recipe provides the declaration, generated client, trusted handler, manifest, test, and run context behind Server.call.
Open call a server function recipe