How to get drizzle-kit to connect to local supabase via websockets with neondatabase/serverless to

Hi,

I am working on an app that I plan to deploy to Cloudflare. I read that neondatabase/serverless is the proper driver to connect a postgres database from that environment.

I am migrating over from Prisma, and I want to introspect my current schema with drizzle-kit pull so I don't have to build it up myself.

When I run drizzle-kit pull, I keep getting this warning: Warning '@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket, which results in an error:

[⣷] 0 tables fetching
[⣷] 0 columns fetching
[⣷] 0 enums fetching
[⣷] 0 indexes fetching
[⣷] 0 foreign keys fetching
[⣷] 0 policies fetching
[⣷] 0 check constraints fetching
[⣷] 0 views fetching
ErrorEvent {
  [Symbol(kTarget)]: _WebSocket {
    _events: [Object: null prototype] {
      ...
    },
    _eventsCount: 4,
    _maxListeners: undefined,
    _binaryType: 'arraybuffer',
    _closeCode: 1006,
    _closeFrameReceived: false,
    _closeFrameSent: false,
    _closeMessage: <Buffer >,
    _closeTimer: null,
    _extensions: {},
    _paused: false,
    _protocol: '',
    _readyState: 3,
    _receiver: null,
    _sender: null,
    _socket: null,
    _bufferedAmount: 0,
    _isServer: false,
    _redirects: 0,
    _autoPong: true,
    _url: 'wss://127.0.0.1/v2',
    _req: null,
    [Symbol(shapeMode)]: false,
    [Symbol(kCapture)]: false
  },
  [Symbol(kType)]: 'error',
  [Symbol(kError)]: Error: connect ECONNREFUSED 127.0.0.1:443
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1634:16) {
    errno: -61,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 443
  },
  [Symbol(kMessage)]: 'connect ECONNREFUSED 127.0.0.1:443'


Reading the
drizzle.config.ts
documentation, I can't seem to find where or how to set the driver. The section on driver only provides three options, but I don't see anything specific to neon.

https://orm.drizzle.team/docs/drizzle-config-file#driver
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Was this page helpful?