Skip to content

# Deploy to Supabase.com

This guide explains the current process for deploying and maintaining workers in hosted environment.

Not production ready

pgflow is currently in Alpha stage and not yet production ready.

Note

Running Edge Worker on Supabase.com currently requires a few additional setup steps. Thanks to ongoing collaboration with the Supabase team, these requirements will be simplified in future releases.

## Deploying workers

Section titled “Deploying workers”

Workers are just regular Edge Functions that run for few minutes and auto-respawn when CPU or Wall clock limits are reached (read more on those Limits | Supabase Docs).

Deploying new version is straightforward - you just update worker code and call `npx supabase functions deploy worker-name` to deploy it.

When deploying a new version of your worker, be aware of the following:

Version Management

Currently, deploying a new version does not automatically terminate the previous version. This behavior will be improved in future releases.

## Starting Workers

Section titled “Starting Workers”

Just like in local development, workers are started with a simple HTTP request. However, you need to pass Authorization header with your ANON_KEY when calling function. Consult this Supabase Docs page for details: Invoking remote functions

After the initial request, the worker will auto-respawn if terminated.

## Stopping Workers

Section titled “Stopping Workers”

Currently, there’s no built-in way to gracefully stop a running worker. You need to remove it from the Supabase Dashboard and wait for its CPU or clock limits to be reached for it to stop.

This will change in future releases.

## Ensuring Worker Availability

Section titled “Ensuring Worker Availability”

To ensure your worker stays active, it’s recommended to use Cron to ping your worker edge function every few seconds. This is recommended in case there are any bugs in the respawn process, which currently is triggered from withing the worker that is shutting down.

Use this Supabase guide Invoking Supabase Function ever few seconds. but use `5 seconds` instead of `30 seconds`.

Note

Make sure to set your own ANON key in the `Authorization` header!