Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Drizzle studio is not working with docker #2990

Closed
natcorsi opened this issue Sep 19, 2024 · 5 comments
Closed

[BUG]: Drizzle studio is not working with docker #2990

natcorsi opened this issue Sep 19, 2024 · 5 comments
Assignees
Labels
bug Something isn't working drizzle/studio Issues related to Drizzle Studio

Comments

@natcorsi
Copy link

natcorsi commented Sep 19, 2024

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 natcorsi added the bug Something isn't working label Sep 19, 2024
@natcorsi natcorsi changed the title [BUG]: [BUG]: Drizzle studio is not working with docker Sep 19, 2024
@RomanNabukhotnyi RomanNabukhotnyi self-assigned this Sep 24, 2024
@RomanNabukhotnyi RomanNabukhotnyi added the drizzle/studio Issues related to Drizzle Studio label Sep 24, 2024
@RomanNabukhotnyi
Copy link
Collaborator

RomanNabukhotnyi commented Sep 24, 2024

@natcorsi Hey! Try removing the driver property.

@OzanOcak
Copy link

@natcorsi Hey! Try removing the driver property.

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);

@RomanNabukhotnyi
Copy link
Collaborator

@OzanOcak Are you sure you have exactly the same error? (no such file or directory, mkdir ...)

@OzanOcak
Copy link

OzanOcak commented Sep 25, 2024

@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.

@natcorsi
Copy link
Author

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

@natcorsi natcorsi closed this as completed Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working drizzle/studio Issues related to Drizzle Studio
Projects
None yet
Development

No branches or pull requests

3 participants