Aurabase Logo
aurabasedocs
docs›Edge Functions›Errors, timeouts and retries

Errors, timeouts and retries

How to read what `invoke` returns when something goes wrong, and when you can safely call again.

9 min read·Level intermediate·Revised on Oct 12, 2026
This English text was generated automatically from the French original and has not been reviewed yet.
#
Anatomy

1. The error object

invoke returns { data, error } and never throws. error is an AuraError, so isAuraError(error) is true. Two subclasses tell you who failed:

classify.tstypescript
import { FunctionsHttpError, FunctionsRelayError } from '@aurabase/aurabase-js'

const { data, error } = await aura.functions.invoke('checkout', { body })

if (error instanceof FunctionsHttpError) {
  // Your function answered, with an error status. Debug your code.
} else if (error instanceof FunctionsRelayError) {
  // The platform failed: the answer of your function never came back.
} else if (error) {
  // The call was cancelled or refused on the client (timeout, invalid_body, no_session).
}
FieldMeaning
error.statusHTTP status. 0 means the failure happened on the client (no response).
error.codeStable identifier, for example NOT_FOUND, QUOTA_EXCEEDED, timeout, invalid_body.
error.messageThe text your function returned, or the platform's explanation.
error.contextOn a FunctionsHttpError: the body your function returned (parsed JSON or text).
error.detailsThe raw error body. For a platform error it contains error.request_id.
#
Diagnosis

2. Which error is it?

Behaviours observed against a running stack. The quota row follows the backend's error mapping and was not triggered in our tests.

What happenedClassstatuscodemessage
The function does not existFunctionsHttpError404NOT_FOUND"…Fonction 'nope' introuvable"
Your function returns 500 with textFunctionsHttpError500http_500that text
Your function returns 503 itselfFunctionsHttpError503http_503what you returned
Your function throwsFunctionsHttpError500http_500"Internal Server Error"
Your function exceeds its timeout_secsFunctionsHttpError500 or 503http_500 / http_503"Function execution failed" or "Function returned HTTP 503"
The runtime is unreachableFunctionsRelayError503SERVICE_UNAVAILABLEexplains that the function was not run
The network fails before any responseFunctionsRelayError0network_errorthe network error
Plan quota exhaustedFunctionsHttpError403QUOTA_EXCEEDEDthe quota message
Too many calls from one clientFunctionsHttpError429rate_limit_exceededwait message
Request body too largeFunctionsRelayError503SERVICE_UNAVAILABLE"max payload size exceeded"
You cancelled, or your timeout elapsedAuraError0timeout"Function invocation aborted or timed out"
The body cannot be sent as JSONAuraError0invalid_bodynames the type to avoid
A 503 from your function is not a platform failure

If your own code returns 502, 503 or 504, you get a FunctionsHttpError: the class tells you who answered, not what the status number is.

Two failures look like something else

A request body above about 256 KiB is rejected with 503 SERVICE_UNAVAILABLE, and a response of about 300 KB or more did not return within our 50-second test. See limits. Retrying does not help; send less data, or use Storage.

#
Retry

3. Decide whether to retry

The SDK never retries an invocation for you: your function may have side effects, and a repeated POST is not safe by default. You decide, using the table below.

FailureDid the function run?Safe to retry?
503 from the platform (FunctionsRelayError)No, the runtime was unreachableYes, with a short back-off
429NoYes, after the delay in error.retryAfter
403 QUOTA_EXCEEDEDNoNo, until the quota resets or you change plan
status 0 (network_error)UnknownOnly if your function is idempotent
timeout on the clientUnknownOnly if your function is idempotent
FunctionsHttpError 5xxYes, partially or fullyOnly if your function is idempotent
FunctionsHttpError 4xxYesNo: fix the request
retry.tstypescript
import { FunctionsRelayError } from '@aurabase/aurabase-js'

async function invokeWithRetry(name: string, body: unknown, attempts = 3) {
  for (let i = 0; i < attempts; i++) {
    const res = await aura.functions.invoke(name, { body })
    const safe = res.error instanceof FunctionsRelayError && res.error.status === 503
    if (!res.error || !safe) return res
    await new Promise((r) => setTimeout(r, 2 ** i * 500))
  }
  return aura.functions.invoke(name, { body })
}
Make the function idempotent instead

The platform does not deduplicate calls and ignores Idempotency-Key. For payments or e-mail, store a key that you pass in body and check it at the start of the function.

#
Time

4. Timeouts

Three clocks run at once:

ClockDefaultWhere to change it
Your client30 s for every responseTypeinvoke(…, { timeout }), { signal }, or requestTimeoutMs in the client options
The function30 s, between 1 and 300permissions.timeout_secs on the function
The gateway380 snot configurable by projects

When the function exceeds timeout_secs, the runtime cancels it and your call fails after about that delay, with the 500 or 503 shown above. The cause appears in error.context.detail (WorkerRequestCancelled: request has been cancelled by supervisor) in raw mode. Set your client timeout slightly above the function's timeout_secs to see this error instead of a client timeout.

timeout.tstypescript
const { error } = await aura.functions.invoke('report', { timeout: 35_000 })
if (error?.code === 'timeout') {
  // Cancelled by your client. The function may still be running.
}

For work longer than a few seconds, enqueue a job instead of holding a connection open.

#
Debug

5. Find the cause

  • Platform errors carry a request id: error.details.error.request_id. Quote it when you contact support.
  • aura functions logs <name> lists recent HTTP requests with method, path, status, duration and request id. It does not show what your function wrote with console.log or console.error: that output stays in the runtime's own logs, which only the platform operator can read. See limits for this and the other current gaps.
  • The identifier of the call is not forwarded to your function. Pass your own id in headers and log it.
Last updated · Oct 12, 2026