drizzle-team / drizzle-team/drizzle-orm
[BUG]: Cannot read properties of null (reading 'open') when running `npx drizzle-kit push`
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [x] I have verified that the bug I'm about to report hasn't been filed before.
### What version of `drizzle-orm` are you using?
0.40.0
### What version of `drizzle-kit` are you using?
0.30.5
### Other packages
@electric-sql/pglite@0.2.17, typescript@5.0.0
### Describe the Bug
## Undesired behavior
Running `npx drizzle-kit push` puts out `TypeError: Cannot read properties of null (reading 'open')` error.
## Desired Result
No error is shown and the [schema](https://orm.drizzle.team/docs/get-started/pglite-new#step-4---create-a-table) is correctly pushed.
## Reproduction
> [!NOTE]
> Reproduced repository: https://github.com/lukaskoeller/drizzle-pglite-open-reproduction
1. Creating a new SvelteKit app:
```sh
npx sv create my-app
```
2. Follow the "[Get Started with Drizzle and PGlite](https://orm.drizzle.team/docs/get-started/pglite-new)" guide.
3. Add `driver: 'pglite'` to `drizzle.config.ts` to get rid of `To connect to Postgres database - please install either of 'pg', 'postgres', '@neondatabase/serverless' or '@vercel/postgres' drivers`.
4. Run `npx drizzle-kit push`
5. This puts out following error in the zsh:
```zsh
lukas@Mac readii % npx drizzle-kit push
No config path provided, using default 'drizzle.config.ts'
Reading config file '/Users/lukas/Documents/priv/readii/drizzle.config.ts'
TypeError: Cannot read properties of null (reading 'open')
at Object.getDB (/Users/lukas/Documents/priv/readii/node_modules/.pnpm/@electric-sql+pglite@0.2.17/node_modules/@electric-sql/pglite/release/postgres.js:9:113692)
at Object.getRemoteSet (/Users/lukas/Documents/priv/readii/node_modules/.pnpm/@electric-sql+pglite@0.2.17/node_modules/@electric-sql/pglite/release/postgres.js:9:114890)
at callback (/Users/lukas/Documents/priv/readii/node_modules/.pnpm/@electric-sql+pglite@0.2.17/node_modules/@electric-sql/pglite/release/postgres.js:9:113341)
at Object.getLocalSet (/Users/lukas/Documents/priv/readii/node_modules/.pnpm/@electric-sql+pglite@0.2.17/node_modules/@electric-sql/pglite/release/postgres.js:9:114798)
at Object.syncfs (/Users/lukas/Documents/priv/readii/node_modules/.pnpm/@electric-sql+pglite@0.2.17/node_modules/@electric-sql/pglite/release/postgres.js:9:113275)
at mount (/Users/lukas/Documents/priv/readii/node_modules/.pnpm/@electric-sql+pglite@0.2.17/node_modules/@electric-sql/pglite/release/postgres.js:9:131497)
at Array.forEach ()
at Object.syncfs (/Users/lukas/Documents/priv/readii/node_modules/.pnpm/@electric-sql+pglite@0.2.17/node_modules/@electric-sql/pglite/release/postgres.js:9:131429)
at (/Users/lukas/Documents/priv/readii/node_modules/.pnpm/@electric-sql+pglite@0.2.17/node_modules/@electric-sql/pglite/src/fs/idbfs.ts:31:26)
at new Promise ()
```
## Context
`tsconfig.json`
```json
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}
```
`.sveltekit/tsconfig.json`
```json
{
"compilerOptions": {
"paths": {
"$lib": [
"../src/lib"
],
"$lib/*": [
"../src/lib/*"
]
},
"rootDirs": [
"..",
"./types"
],
"verbatimModuleSyntax": true,
"isolatedModules": true,
"lib": [
"esnext",
"DOM",
"DOM.Iterable"
],
"moduleResolution": "bundler",
"module": "esnext",
"noEmit": true,
"target": "esnext"
},
"include": [
"ambient.d.ts",
"non-ambient.d.ts",
"./types/**/$types.d.ts",
"../vite.config.js",
"../vite.config.ts",
"../src/**/*.js",
"../src/**/*.ts",
"../src/**/*.svelte",
"../tests/**/*.js",
"../tests/**/*.ts",
"../tests/**/*.svelte"
],
"exclude": [
"../node_modules/**",
"../src/service-worker.js",
"../src/service-worker/**/*.js",
"../src/service-worker.ts",
"../src/service-worker/**/*.ts",
"../src/service-worker.d.ts",
"../src/service-worker/**/*.d.ts"
]
}
```
Contributor guide
Assessment
This issue has not been assessed yet.