drizzle-team / drizzle-team/drizzle-orm
[SUGGESTION] drizzle.config.ts non-default export error description improvement
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
After using `defineConfig()` to create my configuration for `drizzle.config.ts` , and using the command:
```
drizzle-kit push:pg --config=/drizzle.config.ts
```
I was met with a rather confusing error:
```
Invalid input Only "pg" is available options for "--driver"
```
This error was being caused because I had not defined my configuration as the default export of the file, I had instead exported it as a constant, as seen below:
```typescript
import { defineConfig } from "drizzle-kit"
import { env } from "~/env"
export const drizzleConfig = defineConfig({ //This line is causing the error
schema: "./schema.ts",
out: "./../../drizzle",
driver: "pg",
dbCredentials: {
connectionString: env.POSTGRES_URL,
},
verbose: true,
strict: true,
})
```
Eventually I spotted my fault and was easily able to stop the error occuring by removing the constant and just exporting the configuration as the default export directly. However the error description lead to me believing that something within my actual configuration definition was the error's cause, specifically the driver, and wasting a fair bit of time as a result.
I suggest that an improved error description be added such that if `drizzle.config.ts` is read in without a default export, the error description instead reads something along the lines of: `no default export found in 'drizzle.config.ts' , are you sure you exported config as default?`
Contributor guide
Assessment
This issue has not been assessed yet.