Docs

Deploying and running functions

Deploy from the console, the CLI or GitHub; dependencies; versions and rollback; environments; calling synchronously, asynchronously or streaming; response headers, errors and retries; and reading your data safely from a function.

Updated Oct 17, 2026Open in console

Ways to deploy

FromHowGood for
ConsoleFunctions › your function › edit › Save & deploySmall functions, quick fixes
CLIsov fn deploy ./folder --name hello --note "…"Code in your repository, CI
GitHubImport a function from a connected repository; commit console edits backTeams that review code in GitHub

The entry file is main.py (Python) or index.mjs / index.js (Node.js); --entrypoint and --handler change it. Every deploy is a new version; a deploy that fails never replaces the version serving traffic.

sov fn deploy ./functions/send-receipt --name send-receipt --note "retry on 5xx"
sov fn versions send-receipt
sov fn rollback send-receipt          # back to the previous version

Dependencies

The standard library (Python) and built-ins such as fetch (Node.js) are always there. To ship packages, vendor them with your code and deploy with --include-deps (bundles node_modules or vendored Python packages) — available on paid plans.

FreeProUltraTeamEnterprise
Bundle your own function dependencies—✓✓✓✓

Environments

Deploying through an environment's URL (staging, a version) creates that environment's own copy; production keeps serving its version. When the change is ready, promote it to production — Environments, staging and deploying to production. Secrets and environment variables stay per environment, so staging never uses production keys.

Call it

WayUse for
POST /functions/v1/<name> (sovaria.functions.call)Answers within a request: the response is what the function returns.
Asynchronously (sovaria.functions.invokeAsync, sov fn invoke --async)Long work. You get an invocation id at once; read its status and result later (sovaria.functions.invocationStatus(id), GET /api/v1/fn/invocations/<id>).
StreamingSend output as it is produced (AI responses) — Local development, logs and streaming.
Triggers and schedulesRun on database, auth, storage or realtime events, or on a cron schedule — Event triggers.

Successful responses carry X-Sovaria-Invocation-Id (find the run in the logs), X-Sovaria-Duration-Ms and X-Sovaria-Compute-GB-Seconds.

Errors

You getBecause
401The function requires sign-in and the caller isn't signed in.
403Only the service key may call it, or the browser origin isn't allowed.
404No function with that name in this environment.
409It was saved but never deployed.
413The request body is over the function's limit.
429The function's rate limit, or the organization's concurrent-run limit, was reached — retry after Retry-After.
5xxYour code raised an error or ran out of time or memory. The run is logged as FAILED or TIMEOUT with the error.

HTTP calls are not retried for you. Event triggers retry failed runs and keep the ones that keep failing in a dead-letter queue, so write handlers that can safely run twice (check whether the work was already done before doing it).

Start-up and concurrency

  • Functions run in isolated sandboxes that are reused between calls when possible; the first call after a deploy or a quiet period can take longer.
  • Create clients and read configuration at module level, not inside the handler, so warm calls skip it.
  • How many runs may execute at once is set by your plan; beyond it a call waits briefly, then gets 429 PLAN_LIMIT_REACHED (fn.concurrency) with Retry-After: 2.
FreeProUltraTeamEnterprise
Concurrent function invocations5502005002,000
Monthly function invocations250,0002,000,0006,000,00030,000,000100,000,000
Monthly function compute (GB-seconds)10,000100,000300,0001,500,0005,000,000

Read and write your data from a function

Store a server key as a secret and call your project's API with it. Because a server key passes every access policy, decide in your code what the caller may do — use context.caller — before acting for them.

const URL = process.env.SOVARIA_URL               // https://<project-ref>.sovarias.in
const KEY = process.env.SOVARIA_SERVICE_ROLE_KEY       // bound as a secret

export async function handler(event, context) {
  const userId = context.caller.user_id
  if (!userId) return { error: 'sign in first' }

  const res = await fetch(`${URL}/api/v1/sql/query`, {
    method: 'POST',
    headers: { apikey: KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ sql: 'select id, total from orders where customer_id = $1', params: [userId] }),
  })
  return await res.json()
}
  • Add your project host to the function's allowed hosts — functions can only reach hosts you list.
  • Pass values as params, never inside the SQL string.
  • Prefer a custom key with only the access the function needs over the service role key (Keys, tokens and credentials).
Something unclear or missing on this page?Tell us