Function uuid_generate_v4() does not exist

Describe the problem/error/question

When I update n8n from 2.6.4 to 2.10.2 it throws an error starting the docker n8n-import container.

I have this docker compose

x-n8n: &service-n8n
image: n8nio/n8n:latest
environment:

  • DB_TYPE=postgresdb
  • DB_POSTGRESDB_HOST=db
  • DB_POSTGRESDB_USER=postgres
  • DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
  • DB_POSTGRESDB_DATABASE=postgres
  • N8N_DIAGNOSTICS_ENABLED=false
  • N8N_PERSONALIZATION_ENABLED=false
  • N8N_ENCRYPTION_KEY
  • N8N_USER_MANAGEMENT_JWT_SECRET
  • WEBHOOK_URL=${N8N_HOSTNAME:+https://}${N8N_HOSTNAME:-http://localhost:5678}

services:
n8n-import:
<<: *service-n8n
container_name: n8n-import
entrypoint: /bin/sh
command:

  • “-c”
  • “n8n import:credentials --separate --input=/backup/credentials”
    volumes:
  • ./n8n/backup:/backup

n8n:
<<: *service-n8n
container_name: n8n
restart: unless-stopped
expose:

  • 5678/tcp
    volumes:
  • n8n_storage:/home/node/.n8n
  • ./n8n/backup:/backup
  • ./shared:/data/shared
    depends_on:
    n8n-import:
    condition: service_completed_successfully

For now I set the old version and it goes well. Not sure what can I do because my Suapabase instance has the extension enable

What is the error message (if any)?

Migrations in progress, please do NOT stop the process.
Starting migration CreateWorkflowBuilderSessionTable1770291236000
Migration “CreateWorkflowBuilderSessionTable1770291236000” failed, error: function uuid_generate_v4() does not exist
There was an error running database migrations
function uuid_generate_v4() does not exist

Information on your n8n setup

  • n8n version: n8nio/n8n:latest (2.10.2)
  • Database (default: SQLite): I think it is Supabase
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: linux
1 Like

Hi @Pedro_de_Pedro, welcome to the community!

I noticed that this error may be happening because, in Supabase, the uuid_generate_v4 function lives inside the extensions schema, and that can cause Postgres not to find it during migrations if the connection’s search_path doesn’t include that schema. The Supabase documentation itself shows that the uuid‑ossp extension is installed in the extensions schema by default, so the function does exist, but the environment may not be able to see it if the search_path is different.
What worked for me was adjusting the search_path of the user that n8n uses in the database like this: alter role postgres set search_path = public,extensions; After that, I restarted the containers and the migration completed without errors. This may work for your case as well

@tamy.santos ty for answer but rn i have it already and still doesnt work

What I dont get is why with the 2.6.4 works and not with the new one

Nvm I solved it with this

CREATE OR REPLACE FUNCTION public.uuid_generate_v4()
RETURNS uuid
LANGUAGE sql
AS $$
SELECT extensions.uuid_generate_v4();
$$;

The problem is that for some reason n8n now only reads the public schema so u need to move the extension or create a function in the public schema that call the extension in the extension schema as I did.

2 Likes

Thank you! Also had the same issue

Should I run this in postgres instance? If I run in postgres, I receive the error - “schema “extensions” does not exist”. Are we copying from supabase to postgres or within postgres?

It depends on your case, in my case I have the function uuid_generate_v4 in my extensions schema that is where supabase save the extensions but if u re not using supabase maybe u dont even have the function in any of ur schemas so u have create it from zero in ur public schema

New version [email protected] got released which includes the GitHub PR 26595.

New version [email protected] got released which includes the GitHub PR 26558.