Functions
Customer serverless functions for Amba — write a TypeScript handler, run it locally with hot reload, and ship it to your project's edge runtime.
Amba functions are small TypeScript HTTP handlers that run on Amba's
edge runtime. Each function receives a Request and returns a
Response. Use them for webhook handlers, custom mutation endpoints,
queue consumers, and scheduled jobs.
Handler shape
Export a default async (req: Request) => Response:
That's the entire surface. Standard Request / Response / Headers /
URL / fetch / crypto are available at runtime.
What you can do in a function
- Custom HTTP endpoints — anything you'd put behind a server route: webhook receivers, signed-URL minters, server-only mutations.
- Reads + writes against your collections — call into your project from the handler. Server context bypasses client-side scoping, so you can implement cross-user reads when you need them.
- Queue consumers — bind a function to a queue with
amba functions consume <queue> <function>and it receives one message per delivery. - Cron jobs — register a schedule with
amba functions schedule <name> "<cron>"and the runtime invokes the function on that cadence. - Read secrets — set with
amba secrets set NAME value, read withprocess.env.NAME. Secrets are scoped per-project and never leak cross-tenant.
Three commands you'll use most
amba functions dev <file>— run the handler locally with hot reload while you build.amba functions deploy <file>— bundle and ship to production.amba functions logs <name> --tail— stream live logs from production.
The full command list is on the CLI reference.
Limits
- Bundle size —
amba functions deployreports the bundle size and rejects deploys over the platform cap. Use--dry-runto triage size without uploading. - Per-function rate limits — optional, declared at deploy time with
--rate-limit-window,--rate-limit-max,--rate-limit-key. The edge runtime enforces them pre-dispatch (the handler never runs for rate-limited requests). - Runtime stdlib — standard
Request/Response/Headers/URL/crypto/fetchare provided by the platform. Node-specific built-ins (fs,child_process,net) are not.
Next
- Local dev —
amba functions devwalkthrough. - Deploy — ship to production.
- CLI reference — full command and flag list.