Liking cljdoc? Tell your friends :D

supabase.functions

Invoke Supabase Edge Functions.

Provides a single entry point, invoke, that issues an HTTP request to the project's /functions/v1/<name> endpoint and returns either {:status :body :headers} or an anomaly map.

Example

(require '[supabase.core.client :as client]
         '[supabase.functions :as fns])

(def c (client/make-client "https://abc.supabase.co" "anon-key"))

(fns/invoke c "hello" {:body {:name "world"}})
;; => {:status 200, :body {:message "Hello, world!"}, :headers {...}}

Body encoding

The body type drives content-type:

  • mapapplication/json
  • printable Stringtext/plain
  • byte[]application/octet-stream
  • File/InputStream → caller sets content-type

A content-type already present in :headers always wins.

Response decoding

:response-as controls how the body is returned:

  • :auto — pick a decoder from the response content-type (default)
  • :json — always JSON-decode the body
  • :text — always return a UTF-8 string
  • :byte-array — raw byte[]
  • :streamjava.io.InputStream (caller closes)

Errors

Network failures become {:supabase/code :functions-fetch-error}. Edge runtime relay errors (502/504) become :functions-relay-error. 404 becomes :functions-not-found. All other non-2xx responses become :functions-http-error. The HTTP body (if any) is preserved under :http/body.

Invoke Supabase Edge Functions.

Provides a single entry point, [[invoke]], that issues an HTTP request
to the project's `/functions/v1/<name>` endpoint and returns either
`{:status :body :headers}` or an anomaly map.

## Example

    (require '[supabase.core.client :as client]
             '[supabase.functions :as fns])

    (def c (client/make-client "https://abc.supabase.co" "anon-key"))

    (fns/invoke c "hello" {:body {:name "world"}})
    ;; => {:status 200, :body {:message "Hello, world!"}, :headers {...}}

## Body encoding

The body type drives `content-type`:

  - `map`              → `application/json`
  - printable `String` → `text/plain`
  - `byte[]`           → `application/octet-stream`
  - `File`/`InputStream` → caller sets `content-type`

A `content-type` already present in `:headers` always wins.

## Response decoding

`:response-as` controls how the body is returned:

  - `:auto`       — pick a decoder from the response `content-type` (default)
  - `:json`       — always JSON-decode the body
  - `:text`       — always return a UTF-8 string
  - `:byte-array` — raw `byte[]`
  - `:stream`     — `java.io.InputStream` (caller closes)

## Errors

Network failures become `{:supabase/code :functions-fetch-error}`.
Edge runtime relay errors (502/504) become `:functions-relay-error`.
404 becomes `:functions-not-found`. All other non-2xx responses
become `:functions-http-error`. The HTTP body (if any) is preserved
under `:http/body`.
raw docstring

supabase.functions.specs

Malli schemas for the Functions module.

Malli schemas for the Functions module.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close