cli icon indicating copy to clipboard operation
cli copied to clipboard

`supabase start` leads to: 'ERROR: extension "pg_net" is not available'

Open brendenehlers opened this issue 2 years ago • 6 comments

Describe the bug Running supabase start causes the following error:

$» supabase start                
Applying migration 20240123190414_remote_schema.sql...
ERROR: extension "pg_net" is not available (SQLSTATE 0A000)                      
At statement 10: CREATE EXTENSION IF NOT EXISTS "pg_net" WITH SCHEMA "extensions"

I was successfully able to run this command earlier this afternoon, and to my knowledge didn't make any changes to the migrations that would've broken them. The "statement 10" refers to a migration generated by supabase db pull that's mirrored between the local and remote instances.

When I run the command with the --debug flag, it dumps the entire migration file into the console and doesn't give anymore information aside from what it's trying to process. I can provide that output if needed, but it's incredibly long so I won't include it off the bat.

I tried removing the offending extension, but that just caused the same error with the next line, which was initializing the pg_sodium extension, so I don't believe it's an issue with the specific extension.

I'm at a loss as to what is causing this error. I've included the crash report ID below, hopefully that can shed some light on what is causing this issue.

To Reproduce I wasn't able to repro this in a clean environment. I created a new Supabase project and ran the same migration file as the project throwing the error and was able to successfully start the server. I'm at a loss as to what could be causing this in my original environment but not in the new environment.

Add this SQL to a migration:

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

CREATE EXTENSION IF NOT EXISTS "pg_net" WITH SCHEMA "extensions";

CREATE EXTENSION IF NOT EXISTS "pgsodium" WITH SCHEMA "pgsodium";

Run supabase start

Expected behavior A clear and concise description of what you expected to happen. Local instance of Supabase should start.

System information

  • Ticket ID: 08d69cfbf85f460495b82dfbb0cb6fce
  • OS: MacOS
  • Version of CLI: 1.136.3
  • Versions of services: [from supabase services command]
        SERVICE IMAGE      │        LOCAL         │  LINKED
    supabase/postgres      │ 15.1.0.99            │ 15.1.0.99
    supabase/gotrue        │ v2.132.3             │ v2.132.3
    postgrest/postgrest    │ v11.1.0              │ v11.1.0
    supabase/realtime      │ v2.25.50             │ -
    supabase/storage-api   │ v0.46.5              │ v0.46.5
    supabase/edge-runtime  │ v1.32.0              │ -
    supabase/studio        │ 20240101-8e4a094     │ -
    supabase/postgres-meta │ v0.75.0              │ -
    supabase/logflare      │ 1.4.0                │ -
    bitnami/pgbouncer      │ 1.20.1-debian-11-r39 │ -
    darthsim/imgproxy      │ v3.8.0               │ -

brendenehlers avatar Feb 06 '24 02:02 brendenehlers

Could you try supabase stop --no-backup before starting? This would delete any local docker volumes that may contain stale data.

sweatybridge avatar Feb 06 '24 02:02 sweatybridge

When I did that it still tried loading from the backup after running supabase start. I've tried deleting the volume that contains to the backup information, but running supabase start after that causes the same error

The thing is, when there's an empty backup (running supabase start twice in a row will cause this be) the command will run, but none of my migrations will have been applied to the local instance. Running supabase migrations up to fix that results in the same error.

brendenehlers avatar Feb 06 '24 14:02 brendenehlers

I don't quite follow what's happening here. Could you show me the output from docker volume ls?

To start from fresh, there shouldn't be any volumes with supabase_* prefix.

sweatybridge avatar Feb 06 '24 14:02 sweatybridge

Here's the list of the ones for this project. I only tried deleting the supabase_db_owubhjliuhqhcbhohjhm volume, I'll try again after removing the other volumes.

$» docker volume ls                                                             
DRIVER    VOLUME NAME
local     supabase_config_owubhjliuhqhcbhohjhm
local     supabase_db_owubhjliuhqhcbhohjhm
local     supabase_deno_relay_owubhjliuhqhcbhohjhm
local     supabase_edge_runtime_owubhjliuhqhcbhohjhm
local     supabase_inbucket_owubhjliuhqhcbhohjhm
local     supabase_storage_owubhjliuhqhcbhohjhm

[EDIT] Tried after removing all volumes and got the same error. Also tried removing all images, volumes, containers, etc. and still got the same error when running supabase start. The error still occurred when trying to apply migrations, downloading the images went fine.

brendenehlers avatar Feb 06 '24 14:02 brendenehlers

Thanks, at least this rules out issues with stale docker volumes.

I'm still unable to reproduce this issue using postgres 15.1.0.99 image. Could you open a support ticket from the dashboard so I can take a closer look at your project schema?

sweatybridge avatar Feb 06 '24 15:02 sweatybridge

Created a support ticket. The project reference is owubhjliuhqhcbhohjhm. [EDIT] Support ticket ID: 2343361576

Let me know if you need some other identifier to locate the issue.

I appreciate the help!

brendenehlers avatar Feb 06 '24 20:02 brendenehlers