Getting Started

On the bolt.new homepage, hover over the left-hand side of the page and navigate to Settings > Applications. Click “Connect” next to Supabase. Log in with your Supabase credentials.

Using Supabse with your Bolt.new Project

With your Bolt project open, select “Connect to Supabase” at the top-right of the page:

From here, you can either connect to an existing Supabase project or create a new project:

Edge Functions

Edge functions in Bolt rely on Supabase. Before you begin, make sure you have connected your Supabase account as describe above. To get started, prompt Bolt to create the edge function you are interested in. For example: “Create an edge function to handle a conversation with an AI Bot (OpenAI)”. From here, Bolt will generate the edge function.

Possible Errors

The following diagram outlines some example services users may want to use edge functions for and how these interact with one another. At each point of interaction in the diagram, there is the potential for an error:

Cross-Origin Resource Sharing (CORS) Errors

If your edge function is not working correctly, it may be due to a CORS error. To check this, open Chrome DevTools (Command + Option + J Mac, Control + Shift + J Windows / Linux) and check the Network tab. Look for errors related to CORS. Next, check if CORS headers are set correctly in the file responsible for your edge function. Here are the CORS headers for a chatbot built with Bolt using OpenAI:

const corsHeaders = {
  'Access-Control-Allow-Origin': '*',
  'Access-Control-Allow-Methods': 'POST, OPTIONS',
  'Access-Control-Allow-Headers': 'Content-Type, Authorization',
};

You can use Discussion Mode to ask Bolt about whether CORS headers exist and are set correctly in your application.

Missing Secret

When using edge fuctions with services like OpenAI, you must add the secret in the Edge Functions section of your project in Supabase. With your project open, hover over the left-hand side of the page and open Edge Functions > Secrets:

Check Bolt’s recent output for information on naming:

Following this, you can prompt Bolt to inform the model of this update and continue development.

Webhooks
If you are planning to have a webhook that is invoked by a third-party service (e.g. GitHub, Slack), make sure you disable JWT verfication on your edge function in Supabase and add any forms of validation and authorization that are required. For example, GitHub describes the proper procedure for validating webhook deliveries here.

Pricing and Upgrades

By default, users are on the Supabase free tier. You can upgrade your plan on Supabase as needed. Note: on Supabase, you are granted two projects on the free tier. Paused projects do not count towards your free project limit.