[BUG]: Drizzle studio is not working with docker
What version of drizzle-orm are you using?
0.33.0
What version of drizzle-kit are you using?
0.24.2
Describe the Bug
$ npx drizzle-kit studio
No config path provided, using default 'drizzle.config.ts' Reading config file '/home/nathan/-CODIGOS-/InOrbit/Projeto/drizzle.config.ts' Error: ENOENT: no such file or directory, mkdir '/home/nathan/-CODIGOS-/InOrbit/Projeto/postgres:/docker:docker@localhost:5432/inorbit' at Module.mkdirSync (node:fs:1372:26) at new a (/home/nathan/-CODIGOS-/InOrbit/Projeto/node_modules/@electric-sql/pglite/src/fs/nodefs.ts:15:10) at Se (/home/nathan/-CODIGOS-/InOrbit/Projeto/node_modules/@electric-sql/pglite/src/fs/index.ts:42:10) at async Z.Ue (/home/nathan/-CODIGOS-/InOrbit/Projeto/node_modules/@electric-sql/pglite/src/pglite.ts:165:63) at async preparePostgresDB (/home/nathan/-CODIGOS-/InOrbit/Projeto/node_modules/drizzle-kit/bin.cjs:71844:11) at async drizzleForPostgres (/home/nathan/-CODIGOS-/InOrbit/Projeto/node_modules/drizzle-kit/bin.cjs:80451:18) at async Object.handler (/home/nathan/-CODIGOS-/InOrbit/Projeto/node_modules/drizzle-kit/bin.cjs:83972:17) at async run (/home/nathan/-CODIGOS-/InOrbit/Projeto/node_modules/drizzle-kit/bin.cjs:82064:7) { errno: -2, code: 'ENOENT', syscall: 'mkdir', path: '/home/nathan/-CODIGOS-/InOrbit/Projeto/postgres:/docker:docker@localhost:5432/inorbit' }
Expected behavior
I'm trying to connect drizzle with the postgres container, when trying to run drizzle studio I get the error. Am I doing something wrong?
Environment & setup
// drizzle.config.ts
import { defineConfig } from 'drizzle-kit';
import { env } from './src/env';
export default defineConfig({
schema: './src/db/schema.ts',
dialect: 'postgresql',
out: './.migrations',
driver: 'pglite',
dbCredentials: {
url: env.DATABASE_URL,
},
});
// docker-compose.yml
name: pocket-js-server
services:
db:
image: postgres:15.5
ports:
- 5432:5432
environment:
- POSTGRES_USER = docker
- POSTGRES_PASSWORD = docker
- POSTGRES_DB = inorbit
- POSTGRES_HOST_AUTH_METHOD=trust
// .env
DATABASE_URL = postgres://docker:docker@localhost:5432/inorbit
@natcorsi Hey! Try removing the driver property.
@natcorsi Hey! Try removing the
driverproperty.
I don't have driver but having same error, my db is also located in docker container.
import * as dotenv from "dotenv"; import { defineConfig, type Config } from "drizzle-kit";
dotenv.config({ path: ".env" });
export default defineConfig({ schema: "./src/drizzle/schema.ts", out: "./src/drizzle/migrations", dialect: "postgresql", dbCredentials: { url: process.env.DATABASE_URL as string, }, } as Config);
@OzanOcak Are you sure you have exactly the same error? (no such file or directory, mkdir ...)
@OzanOcak Are you sure you have exactly the same error? (no such file or directory, mkdir ...)
it was No config path provided, using default 'drizzle.config.ts' error. I got it after I tried to migrate drizzle orm to postgres db running on docker container. I don't have verbose error right now, I will try to run generate and migrate drizzle commands on docker file, once I get back to my computer.
Well, in my case, this was only resolved because I removed the inorbit from the end of the link in the .env file, it wasn't finding