How to use vercel postgres in localhost?
I have set up drizzle according to the docs, and can use drizzle kit to run migrations alright. (I have seen the tables created in vercel dashboard).
Still, when I try to use any drizzle functions in my sveltekit app, I get a websocket error. Any idea what I need to do to get vercel-postgres working?
Here's the relevant code and errors:
1 Reply
The crash is ocurring on page load, when I load a page that will try to run
getUserWithApiKeys
server-side. Here's the error I'm getting:
The linked docs only tell me how to configure a neon
database, which I know is the technology vercel is using. Sadly, the API neon seems to suggest using in the linked docs doesn't seem to exist for the vercel postgres package
I've searched quite a bit around. The only other people I have found online talking about using drizzle and vercel-postgres together recommend checking the current environment and selecting a different database driver depending on that.
I'm honestly bummed out by this. I don't think it's a good idea to use different database drivers in development and production. I'm using postgresjs for local development for the time being, but I'm already looking into using something other than vercel-postgres. The main reason is that I think it's going to be hell to debug if any behavior is different between postgres and vercel-postgres drivers.
Hope this helps someone that stumbles into the same issue later.