https://<func-name>-<org-nickname>.telnyxcompute.com (see Routing) and are handed to your entrypoint — but what “your entrypoint” means differs by language. In TypeScript and JavaScript you own and run the HTTP server (the CLI scaffolds a working one); in Go, Python, and Java the server is run for you and your code is called per request.
telnyx-edge new-func -l <language> generates a working entrypoint for each language. The code on this page is that scaffold — start from it rather than a blank file.
The contract at a glance
| Language | File | You implement | Server owned by | Health probes |
|---|---|---|---|---|
| TypeScript / JavaScript | index.ts / index.js (project root) | An HTTP server on process.env.PORT || 8080 | You | You — return 200 for /health and paths under it |
| Go | handler.go | func Handle(w http.ResponseWriter, r *http.Request) in package function | Platform | Handled for you — no health route in your code |
| Python | function/func.py | new() factory returning an object with async def handle(self, scope, receive, send) | Platform | Platform — probes never reach handle() |
| Java | src/main/java/functions/Function.java | A method annotated @Funq (Quarkus Funqy) | Quarkus | SmallRye Health at /health/*, pre-configured |
The scaffold, by language
Each tab is one language’s entrypoint contract and the scaffoldnew-func generates for it.
- TypeScript / JavaScript
- Go
- Python
- Java
You own the server. There is no framework-provided The JavaScript scaffold (
handler(request) entrypoint and no Response object to return — your function is a container running a plain node:http server (or any server framework you install). Two things are contractual:- Listen on
process.env.PORT, falling back to8080. - Answer
/health(and paths under it) with a200. The platform’s liveness and readiness probes hit it — a function that doesn’t answer isn’t routed traffic and can be restarted. Keep the probe path fast: respond before any other work.
index.ts lives at the project root, next to func.toml — not in src/. The scaffold, lightly condensed (comments trimmed):-l js) is the same file minus type annotations, at index.js (same project-root location).Request bodies arrive as data events carrying Buffer chunks. The scaffold accumulates them as a string, which is fine for text and JSON — for binary bodies collect the buffers instead (chunks.push(chunk) then Buffer.concat(chunks)), because toString() corrupts non-UTF-8 bytes.Bodies, headers, and binary data
These apply to the raw-HTTP contracts — TypeScript, JavaScript, Go, and Python. Java/Funqy is the exception: it’s typed JSON in/out, so raw bodies, binary responses, and custom headers aren’t available from a@Funq method (see the Java tab).
-
Bodies pass through raw, both directions. There is no base64 envelope and no JSON wrapping between the caller and your code. To serve binary, set the
Content-Typeand write the bytes: -
Headers are yours. Whatever your server (or
Handle, orhttp.response.start) sets is what the caller receives. There is no platform header rewriting to work around. - Bodies are size-capped. Request and response body limits are listed in Limits.
The request budget
A function has 30 seconds by default to respond, and 60 seconds at most. Past the budget the request is terminated and the caller gets a504. This is a platform limit, not a func.toml field — there is no timeout_seconds setting.
For work that can run long, set your own internal timeout a few seconds under the platform’s and return an error or partial result instead of being cut off mid-response. Exact numbers and the other caps — memory, body size, deploy rate — are in Limits.
Related
- Bindings — the typed
envsurface: Telnyx API, secrets, KV - Execution model — lifecycle, cold starts, concurrency
- Limits — timeouts, body size, memory