Skip to content

function gen_salt(unknown) does not exist - CLI DB PushΒ #4640

@Olyno

Description

@Olyno

Describe the bug

When running supabase db reset --linked, all migrations are running well, except the seed.sql which throws failed to send batch: ERROR: function gen_salt(unknown) does not exist (SQLSTATE 42883).

The exact same code, from seed.sql, executed inside the SQL Editor of the cloud version, is running perfectly fine.

To Reproduce

  1. Create a seed.sql file in your local project.
  2. Add the following:
-- =========================================================
-- Extensions
-- =========================================================
create extension if not exists "pgcrypto";

-- =========================================================
-- Auth users
-- =========================================================
insert into auth.users (
  instance_id,
  id,
  aud,
  role,
  email,
  encrypted_password,
  email_confirmed_at,
  recovery_sent_at,
  last_sign_in_at,
  raw_app_meta_data,
  raw_user_meta_data,
  created_at,
  updated_at,
  confirmation_token,
  email_change,
  email_change_token_new,
  recovery_token
)
values
  (
    '00000000-0000-0000-0000-000000000000',
    '11111111-2222-3333-4444-555555555555',
    'authenticated',
    'authenticated',
    '[email protected]',
    crypt('password', gen_salt('bf')),
    now(), now(), now(),
    '{"provider":"email","providers":["email"]}'::jsonb,
    '{}'::jsonb,
    now(), now(), '', '', '', ''
  ),
  (
    '00000000-0000-0000-0000-000000000000',
    '22222222-3333-4444-5555-666666666666',
    'authenticated',
    'authenticated',
    '[email protected]',
    crypt('password', gen_salt('bf')),
    now(), now(), now(),
    '{"provider":"email","providers":["email"]}'::jsonb,
    '{}'::jsonb,
    now(), now(), '', '', '', ''
  ),
  (
    '00000000-0000-0000-0000-000000000000',
    '33333333-4444-5555-6666-777777777777',
    'authenticated',
    'authenticated',
    '[email protected]',
    crypt('password', gen_salt('bf')),
    now(), now(), now(),
    '{"provider":"email","providers":["email"]}'::jsonb,
    '{}'::jsonb,
    now(), now(), '', '', '', ''
  )
on conflict (id) do nothing;

-- =========================================================
-- Auth identities
-- =========================================================
insert into auth.identities (
  id,
  user_id,
  identity_data,
  provider,
  provider_id,
  last_sign_in_at,
  created_at,
  updated_at
)
select
  gen_random_uuid(),
  u.id,
  format('{"sub":"%s","email":"%s"}', u.id::text, u.email)::jsonb,
  'email',
  gen_random_uuid(),
  now(),
  now(),
  now()
from auth.users u
where u.email in (
  '[email protected]',
  '[email protected]',
  '[email protected]'
)
and not exists (
  select 1 from auth.identities i
  where i.user_id = u.id and i.provider = 'email'
);
  1. Link your local project using supabase link --project-ref command.
  2. Run supabase db reset --linked
  3. See error

I also tried with:

create extension if not exists pgcrypto with schema extensions;, same issue.

Expected behavior

Everything should be running smoothly.

Screenshots

/

System information
Rerun the failing command with --create-ticket flag.

  • Ticket ID: e00e0ca9b3794ae692781d07a935bff9
  • Version of OS: Fedora 43+
  • Version of CLI: 2.67.1
  • Version of Docker: Docker version 29.1.3, build f52814d
  • Versions of services:
SERVICE IMAGE          | LOCAL                  | LINKED     
  ------------------------|------------------------|------------
   supabase/postgres      | 17.6.1.063             | 17.6.1.063 
   supabase/gotrue        | v2.184.0               | v2.184.0   
   postgrest/postgrest    | v14.1                  | v14.1      
   supabase/realtime      | v2.68.4                | -          
   supabase/storage-api   | v1.33.0                | v1.31.1    
   supabase/edge-runtime  | v1.69.28               | -          
   supabase/studio        | 2025.12.09-sha-434634f | -          
   supabase/postgres-meta | v0.95.1                | -          
   supabase/logflare      | 1.27.0                 | -          
   supabase/supavisor     | 2.7.4                  | - 

Additional context

I noticed some users having this issue in the past, but nothing has been found to fix it.

It would also be great if we could have a small guide in the docs to insert users in the database, or even better, if default's Supabase database instance could come with a helper to do that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions