Error: Either `connectionString` or `host, port, etc.` params be provided in config file

Hey, So i'm trying to setup Drizzle with PlanetScale, and want to use the drizzle kit push command, but i run into this error:
throw Error(
^

Error: Either `connectionString` or `host, port, etc.` params be provided in config file
at connectToMySQL (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:45561:15)
at Command2.<anonymous> (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:51266:28)
at Command2.listener [as _actionHandler] (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:832:21)
at /Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1251:69
at Command2._chainOrCall (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1183:16)
at Command2._parseCommand (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1251:31)
at /Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1120:31
at Command2._chainOrCall (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1183:16)
at Command2._dispatchSubcommand (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1116:27)
at Command2._parseCommand (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1222:23)
throw Error(
^

Error: Either `connectionString` or `host, port, etc.` params be provided in config file
at connectToMySQL (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:45561:15)
at Command2.<anonymous> (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:51266:28)
at Command2.listener [as _actionHandler] (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:832:21)
at /Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1251:69
at Command2._chainOrCall (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1183:16)
at Command2._parseCommand (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1251:31)
at /Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1120:31
at Command2._chainOrCall (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1183:16)
at Command2._dispatchSubcommand (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1116:27)
at Command2._parseCommand (/Users/oscar/Projects/popfeed/node_modules/drizzle-kit/index.js:1222:23)
Config
import type { Config } from 'drizzle-kit';

export default {
schema: './src/lib/db/schema.ts',
out: './src/lib/db/migrations',
connectionString: process.env['DATABASE_URL']
} satisfies Config;
import type { Config } from 'drizzle-kit';

export default {
schema: './src/lib/db/schema.ts',
out: './src/lib/db/migrations',
connectionString: process.env['DATABASE_URL']
} satisfies Config;
I'm using a connectionString that is formatted like this in my .env:
DATABASE_URL='mysql://USERNAME:[email protected]/popfeed?sslaccept=strict'
DATABASE_URL='mysql://USERNAME:[email protected]/popfeed?sslaccept=strict'
Everything i can google my way to, do it the same way, and i really can't seem to figure out what i'm doing wrong here? Anyone that can point me in the right direction
9 Replies
Flo
Flo2y ago
I think you have to use the package dotenv and import it like this for the enviroment variables
import 'dotenv/config';
import 'dotenv/config';
Also make sure when using it the env file is named .env and not something like .env.local
oscklm
oscklmOP2y ago
Thanks. It was in fact because of the dotenv package noget being used.
mr_pablo
mr_pablo2y ago
I have this issue, without using env vars
Andrii Sherman
can you show your config file? You can replace connection string with empty string
mr_pablo
mr_pablo2y ago
It was a documentation error. Docs show db but its database
Andrii Sherman
thanks a lot! fixing that
mr_pablo
mr_pablo2y ago
Thank you!
does this matter
Should i just rewrite my schema in drizzle?
Want results from more Discord servers?
Add your server