Supabase.Functions
8.0.0
dotnet add package Supabase.Functions --version 8.0.0
NuGet\Install-Package Supabase.Functions -Version 8.0.0
<PackageReference Include="Supabase.Functions" Version="8.0.0" />
<PackageVersion Include="Supabase.Functions" Version="8.0.0" />
<PackageReference Include="Supabase.Functions" />
paket add Supabase.Functions --version 8.0.0
#r "nuget: Supabase.Functions, 8.0.0"
#:package Supabase.Functions@8.0.0
#addin nuget:?package=Supabase.Functions&version=8.0.0
#tool nuget:?package=Supabase.Functions&version=8.0.0
Supabase.Functions
A C# client for invoking Supabase Edge Functions.
Part of the Supabase C# SDK. Most projects
use it through the Supabase meta-package (supabase.Functions); reference
this package directly when you only need to invoke functions.
Installation
dotnet add package Supabase.Functions
Targets .NET Standard 2.0.
Getting started
Create a client pointed at your project's Functions URL, then invoke a function by name:
using Supabase.Functions;
var client = new Client("https://PROJECT_ID.supabase.co/functions/v1");
// Invoke and read the raw string response.
var body = await client.Invoke("hello-world", token: SUPABASE_ANON_KEY);
Invoke needs a bearer token to authorize the request — your project's anon key, or a user's access
token. Through the Supabase meta-package the token is supplied for you.
Deserializing the response
Use the generic overload to deserialize the JSON body into a type:
var result = await client.Invoke<MyResponse>("hello-world", token: SUPABASE_ANON_KEY);
Passing a body, headers, method, or region
InvokeFunctionOptions covers the common per-call settings:
var options = new Client.InvokeFunctionOptions
{
Body = new Dictionary<string, object> { { "name", "world" } },
Headers = new Dictionary<string, string> { { "x-trace", "abc" } },
HttpMethod = HttpMethod.Post,
FunctionRegion = FunctionRegion.UsEast1
};
var result = await client.Invoke<MyResponse>("hello-world", token: SUPABASE_ANON_KEY, options);
Observability (OpenTelemetry)
The client emits traces and metrics through System.Diagnostics, so you can wire them into
OpenTelemetry (or any ActivityListener / MeterListener) without taking a dependency on the
OpenTelemetry packages. Emission is zero-cost while nothing is listening, so it is always on and stays
silent until you subscribe.
Register the client's ActivitySource and Meter by name. Use the FunctionsDiagnostics.SourceName
constant rather than hardcoding the string, so a typo becomes a compile error instead of a silent
no-op:
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
using Supabase.Functions;
// Requires OpenTelemetry.Extensions.Hosting and an exporter package (e.g. OTLP) in your app.
builder.Services.AddOpenTelemetry()
.WithTracing(tracing => tracing
.AddSource(FunctionsDiagnostics.SourceName)
.AddOtlpExporter())
.WithMetrics(metrics => metrics
.AddMeter(FunctionsDiagnostics.SourceName)
.AddOtlpExporter());
Once subscribed you get:
- A client span per invocation, named
{METHOD} {path}and following OpenTelemetry HTTP conventions (method, status code, and a sanitized URL — the query string is never recorded, and neither is the request body). Afaas.invoked_nametag carries the invoked function name. A relay error is reported as a failed span even when the HTTP status is a success. - A
supabase.functions.invoke.durationhistogram (seconds), tagged with method, host, path, function name, and status code.
If you are not using the OpenTelemetry SDK, a raw listener works too:
using System.Diagnostics;
using Supabase.Functions;
using var listener = new ActivityListener
{
ShouldListenTo = source => source.Name == FunctionsDiagnostics.SourceName,
Sample = (ref ActivityCreationOptions<ActivityContext> _) => ActivitySamplingResult.AllData,
ActivityStopped = activity => Console.WriteLine($"{activity.OperationName} {activity.Duration.TotalMilliseconds}ms {activity.Status}")
};
ActivitySource.AddActivityListener(listener);
Contributing
Contributions are welcome. See the repository root for how to build and test the SDK.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Supabase.Core (>= 8.0.0)
- System.Diagnostics.DiagnosticSource (>= 8.0.1)
- System.Text.Json (>= 8.0.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Supabase.Functions:
| Package | Downloads |
|---|---|
|
Supabase
A C# implementation of the Supabase client |
GitHub repositories
This package is not used by any popular GitHub repositories.