drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

[BUG]: drizzle-kit push stuck at "Pulling schema from database..." / not detecting "dialect"

Open daneus opened this issue 2 years ago • 39 comments

What version of drizzle-orm are you using?

0.31.2

What version of drizzle-kit are you using?

0.22.8

Describe the Bug

I have a setup that connects to a Supabase Postgres database.

When I run npx drizzle-kit push it hangs at "Pulling schema from database...":

When I run npx drizzle-kit push --verbose I get this error:

const error2 = new ZodError(ctx.common.issues);
                           ^

_ZodError: [
  {
    "expected": "'postgresql' | 'mysql' | 'sqlite'",
    "received": "undefined",
    "code": "invalid_type",
    "path": [
      "dialect"
    ],
    "message": "Required"
  }
]
    at get error (D:\repos\-----\-------api\node_modules\drizzle-kit\bin.cjs:5183:28)
    at _ZodObject.parse (D:\repos\------\-------api\node_modules\drizzle-kit\bin.cjs:5263:22)
    at preparePushConfig (D:\repos\------\-------api\node_modules\drizzle-kit\bin.cjs:20208:33)
    at _Command.<anonymous> (D:\repos\------\-------api\node_modules\drizzle-kit\bin.cjs:129662:13) {
  issues: [
    {
      expected: "'postgresql' | 'mysql' | 'sqlite'",
      received: 'undefined',
      code: 'invalid_type',
      path: [ 'dialect' ],
      message: 'Required'
    }
  ],
  addIssue: [Function (anonymous)],
  addIssues: [Function (anonymous)],
  errors: [
    {
      expected: "'postgresql' | 'mysql' | 'sqlite'",
    {
      expected: "'postgresql' | 'mysql' | 'sqlite'",
      received: 'undefined',
      code: 'invalid_type',
      path: [ 'dialect' ],
      message: 'Required'
    }
  ]
}
    {
      expected: "'postgresql' | 'mysql' | 'sqlite'",
      received: 'undefined',
    {
    {
      expected: "'postgresql' | 'mysql' | 'sqlite'",
      received: 'undefined',
      code: 'invalid_type',
      path: [ 'dialect' ],
      message: 'Required'
    }
  ]
}

daneus avatar Jul 06 '24 01:07 daneus

@daneus I have the same problem, did you solve yours?

bernhardw avatar Jul 11 '24 09:07 bernhardw

bernhardw

the only solution I found was to save my supabase data as .csv on the dashboard, nuke the database including tables, and rerun the push command and then it would work, then just had to refill my tables with the .csv files

daneus avatar Jul 11 '24 10:07 daneus

@bernhardw, were you able to resolve this, i just came across this same error

Bethel-nz avatar Jul 11 '24 15:07 Bethel-nz

I am getting a similar issue. Fresh Supabase project, fresh latest repo using t3-turbo and stuck on "Pulling Schema" for like 15mins and no errors

artem-alek avatar Nov 01 '24 14:11 artem-alek

a temporary fix what is worked for me is to change the port to 5432 (supavisor session) instead of 6543 in the connection string, like this: postgres://postgres.apbkobhfnmcqqzqeeqss:[YOUR-PASSWORD]@aws-0-ca-central-1.pooler.supabase.com:5432/postgres then changing it back after a finished db push

63r6o avatar Nov 13 '24 16:11 63r6o

I'm currently having the same problem, pushing only works after wiping the entire database. Is there any update on a solution that doesn't require changing the connection string?

aadisang avatar Dec 27 '24 00:12 aadisang

Same here, also verbose is not displaying anything. It just hang there forever.

No config path provided, using default 'drizzle.config.ts'
Reading config file '/Users/.../drizzle.config.ts'
Using 'postgres' driver for database querying
[⣽] Pulling schema from database...

Versions:

drizzle-kit: v0.30.1
drizzle-orm: v0.38.3 

Maxwell2022 avatar Dec 29 '24 23:12 Maxwell2022

+1

riteshreg avatar Dec 30 '24 04:12 riteshreg

+1

mattrobrob avatar Jan 04 '25 14:01 mattrobrob

Getting the same error at latest drizzle-kit version, although the work around by @63r6o works, its quite frustrating, what might be causing this?

BhargavJadhav2804 avatar Jan 12 '25 10:01 BhargavJadhav2804

+1

joshuarussell10 avatar Jan 28 '25 13:01 joshuarussell10

the only thing that worked for me was:

a temporary fix what is worked for me is to change the port to 5432 (supavisor session) instead of 6543 in the connection string, like this: postgres://postgres.apbkobhfnmcqqzqeeqss:[YOUR-PASSWORD]@aws-0-ca-central-1.pooler.supabase.com:5432/postgres then changing it back after a finished db push

TimPietruskyRunPod avatar Jan 29 '25 16:01 TimPietruskyRunPod

a temporary fix what is worked for me is to change the port to 5432 (supavisor session) instead of 6543 in the connection string, like this: postgres://postgres.apbkobhfnmcqqzqeeqss:[YOUR-PASSWORD]@aws-0-ca-central-1.pooler.supabase.com:5432/postgres then changing it back after a finished db push

Thanks. Tried it and it worked. Though to be honest I abandoned project for a month and just continued today with new tables.

traez avatar Feb 02 '25 18:02 traez

a temporary fix what is worked for me is to change the port to 5432 (supavisor session) instead of 6543 in the connection string, like this: postgres://postgres.apbkobhfnmcqqzqeeqss:[YOUR-PASSWORD]@aws-0-ca-central-1.pooler.supabase.com:5432/postgres then changing it back after a finished db push

2025 this still works

j3h7sx avatar Feb 15 '25 07:02 j3h7sx

+1

jacksonthall22 avatar Feb 17 '25 19:02 jacksonthall22

+1

andrewdoro avatar Feb 25 '25 16:02 andrewdoro

a temporary fix what is worked for me is to change the port to 5432 (supavisor session) instead of 6543 in the connection string, like this: postgres://postgres.apbkobhfnmcqqzqeeqss:[YOUR-PASSWORD]@aws-0-ca-central-1.pooler.supabase.com:5432/postgres then changing it back after a finished db push

this solution still works

TazakiN avatar Mar 08 '25 14:03 TazakiN

a temporary fix what is worked for me is to change the port to 5432 (supavisor session) instead of 6543 in the connection string, like this: postgres://postgres.apbkobhfnmcqqzqeeqss:[YOUR-PASSWORD]@aws-0-ca-central-1.pooler.supabase.com:5432/postgres then changing it back after a finished db push

@63r6o this worked for me. Seeing as how we're still having this issue, I'd suggest the Supabase team re-open the issue.

gblikas avatar Mar 13 '25 22:03 gblikas

a temporary fix what is worked for me is to change the port to 5432 (supavisor session) instead of 6543 in the connection string, like this: postgres://postgres.apbkobhfnmcqqzqeeqss:[YOUR-PASSWORD]@aws-0-ca-central-1.pooler.supabase.com:5432/postgres then changing it back after a finished db push

Thank you bro, it worked for me (March 2025)

SamyGenAI avatar Mar 19 '25 16:03 SamyGenAI

@daneus I see that you closed the issue, could you re-open?

gblikas avatar Mar 20 '25 17:03 gblikas