← Server functions

Server.call

luastra/server
Server.call(operation: string, input: { [string]: string }, options: Options?): RequestId

Starts 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

ParameterType / valuesDescription
operationstringDeclared, versioned backend operation name.
input{ [string]: string }Bounded string map sent as operation input; never include client-side secrets.
optionsOptions?Optional deadline and retry policy for the request.
options.deadlineMsinteger (1..30000)?Optional request deadline; defaults to 3000 ms.
options.idempotencyKeystring (8..128 bytes)?Optional stable idempotency key for operations that may be retried.
options.retryboolean?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 learning

Prerequisites

Server.RequestIdServer.Options

Next steps

Server.V2Limits

Complete inventory

View all pages in Server functions
← Previous: Server.ErrorNext: Server.callV2 →