Functions

Keep private logic outside the extension bundle. Create a function, call it locally, inspect its logs, and deploy it when it is ready.

Create a function

In Functions, click New function and choose a name. ChromeShip creates the Deno entry file and starts watching it when the backend runtime is active.

Open the local Supabase Studio

Start the backend runtime, then click Open Supabase Studio to manage the local database visually. Create tables, inspect data, run SQL, and work with Auth or Storage without leaving the local project workflow.

Invoke from the extension

Use functions.invoke for JSON calls. It attaches the current Supabase session and returns the parsed response.

import { functions } from "@/integrations/supabase";
const result = await functions.invoke("hello-world", { name: "World" });

Use functions.raw when you need the original Response, such as a file download, custom headers, or a non-JSON body.

const response = await functions.raw("download-report", {
  method: "POST",
  headers: { "Accept": "application/pdf" },
  body: { id: "123" },
});
const blob = await response.blob();

Deploy

Deploy one function from its row, or deploy all functions together. Each function keeps its own deployment state and timestamp.

Local webhooks with ngrok

Turn on ngrok when an external service must reach a function running on your machine. ChromeShip displays the public URL as soon as the tunnel is ready.

One-time setup

Create a free account at ngrok.com and run this once on your machine:

ngrok config add-authtoken <your-token>

Fixed domain (optional)

Without a reserved domain, ngrok may return a new URL after a restart. Add NGROK_API_KEY in Settings > Environment if you want ChromeShip to reuse an available static domain. Otherwise, update the webhook destination when the URL changes.

Generated function templates

Integration functions are generated when their integration is enabled. Use these references to understand what each endpoint owns.