NeonN
Neon2y ago
9 replies
moderate-tomato

`@neondatabase/serverless` connection string doesn't accept strings without passwords?

Couldn't find much info on this online, but I'm runnign into an odd error with @neondatabase/serverless and trying to initiate a neon instance.

Using the snippet from the drizzle docs:
import { drizzle } from "drizzle-orm/neon-http";
import { neon } from "@neondatabase/serverless";

const sql = neon("postgres://postgres@10.0.0.25/drizzletest");

export const db = drizzle(sql);


It's error out saying:

Error: Database connection string format for `neon()` should be: postgresql://user:password@host.tld/dbname?option=value


Now I know that the protocol prefix postgres:// (as opposed to postgresql:// as shown in the error example) should work, its shown that way elsewhere in the docs / the postgres ecosystem. I've tried both and it still errors. So I can only imagine that it doesnt like the fact that my user postgres doesn't have a password. Removing the user part entirely (so its just postgres://10.0.0.25:5432/drizzletest also throws the same error, not an auth error as might be expected)

Is this not a supported syntax? I'm assuming neondatabase/serverless uses some preexisting postgres conneciton string parsing and/or this is a common enough use-case so this should work 🤔 Or am I missing something simple maybe? 🤷‍♂️
Was this page helpful?