DT
Drizzle Team•2y ago
PGT

Running `drizzle-kit introspect:pg` returns "client password must be a string"

I'm attempting to move from objection.js+knex.js over to Drizzle and I'm running drizzle-kit introspect:pg against my database but I'm getting the error:
Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
Here's my drizzle.config.ts:
import type { Config } from 'drizzle-kit';

export default {
schema: './src/db/schema/*',
out: './src/db/migrations',
connectionString: 'DATABASE_URL',
} satisfies Config;
import type { Config } from 'drizzle-kit';

export default {
schema: './src/db/schema/*',
out: './src/db/migrations',
connectionString: 'DATABASE_URL',
} satisfies Config;
If i change connectionString: 'DATABASE_URL', to connectionString: process.env.DATABASE_URL, I get the error:
Invalid input
Invalid input
I've also tried to specify all the information in my connection string in the CLI params like drizzle-kit instropect:pg --host=... --user=... --password... but get the same error. Any help would be appreciated. Thanks in advance.
4 Replies
PGT
PGTOP•2y ago
Also worth noting I have a .env in the root of my project with:
DATABASE_URL=...
DATABASE_URL=...
Update: hardcoding the user, host, password, database into drizzle.config.ts seems to have allowed it to run successfully... seems ok because it's just a one-time run and the code won't be checked in, only the migration and schema files but maybe there's a bug in reading the config
Dan
Dan•2y ago
Placing .env file on its own won't do anything - it's just a file You need something like dotenv in the Drizzle config to import values from it as environment variables
productdevbook
productdevbook•12mo ago
same problem
No description
productdevbook
productdevbook•12mo ago
postgres://postgres:postgres@localhost:5432/postgres fixed password add forgot 😄
Want results from more Discord servers?
Add your server