mirror of
https://github.com/supabase/supabase.git
synced 2026-09-22 13:37:53 +08:00
a586b6cb82
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com>
80 lines
2.5 KiB
Plaintext
80 lines
2.5 KiB
Plaintext
---
|
|
title = "Transfer edge functions from one project to another"
|
|
topics = [ "cli", "database", "functions" ]
|
|
keywords = [ "functions", "typescript", "deno" ]
|
|
database_id = "83446166-2539-44ce-bde5-9252ce59d2e3"
|
|
---
|
|
|
|
This guide shows how you can transfer your Edge Functions from one project to another using the Supabase CLI or the Supabase Dashboard.
|
|
|
|
## Pre-requisites
|
|
|
|
To follow through this guide, you need the following:
|
|
|
|
- You must have the right access privileges to both the source and target project
|
|
- You must have installed the [Supabase CLI tool](/docs/guides/local-development/cli/getting-started#installing-the-supabase-cli)
|
|
- Both source and target projects must be active
|
|
|
|
## Steps (using the Supabase CLI):
|
|
|
|
1. Login to your Supabase account (the account with the functions) using your terminal
|
|
|
|
```bash
|
|
supabase login
|
|
```
|
|
|
|
This should open up a web page with an access code. Copy the code, paste it in your terminal, and hit enter.
|
|
|
|
2. List all Edge Functions by running the following command
|
|
|
|
```bash
|
|
supabase functions list --project-ref your_project_ref
|
|
```
|
|
|
|
3. Download the function
|
|
|
|
```bash
|
|
supabase functions download function_name --project-ref your_project_ref
|
|
```
|
|
|
|
Repeat this step to download multiple functions.
|
|
|
|
This downloads the function(s) into `supabase/functions`. You can view the downloaded function(s) by running
|
|
|
|
```bash
|
|
ls supabase/functions
|
|
```
|
|
|
|
4. Link to the target project
|
|
|
|
```bash
|
|
supabase link --project-ref your_target_project_ref
|
|
```
|
|
|
|
5. Deploy function(s) to target project
|
|
|
|
```bash
|
|
supabase functions deploy --project-ref your_target_project_ref
|
|
```
|
|
|
|
This deploys all functions within the `supabase/functions` to the target project. You can confirm by checking your Edge Functions on [the project dashboard](/dashboard/project/_/functions)
|
|
|
|
## Steps (using the Supabase Dashboard):
|
|
|
|
1. In the source project, navigate to **Edge Functions** from the side menu
|
|
|
|
2. Using the `Download` button, download your desired function as zip:
|
|

|
|
|
|
3. In the target project, navigate to **Edge Functions** from the side menu
|
|
|
|
4. Click on the `Deploy a new function` button, select **Via Editor** operation
|
|
|
|
5. Drag and drop your downloaded function (the zip function from step 2) into the editor
|
|
|
|
6. Add your function name and click on the `Deploy function` button to deploy the function:
|
|
|
|

|
|
|
|
With this, you can transfer your edge functions between your Supabase projects.
|