drizzle-team / drizzle-team/drizzle-orm

[BUG]: TypeError: `import_pg_core.uuid` is not a function

Open
#3,809 3 comments 0 reactions 0 assignees View on GitHub
bug bug/cant-reproduce db/postgres
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.38.2

### What version of `drizzle-kit` are you using?

0.30.1

### Other packages

_No response_

### Describe the Bug

I'm running an api package that uses the same drizzle schema as the backend for types - when running the client on the frontend (specifically the tests) I'm encountering the following error:

```
TypeError: (0 , import_pg_core.uuid) is not a function

> 1 | import {
| ^
2 | Client,
4 | } from "@org/package";

at Object. (../node_modules/@org/package/src/dbSchema.ts:22:7)
...

```

Strangely this is only caused by the uuid - removing it from my table definitions means fixes the problem, the other `drizzle-orm/pg-core` imports don't raise errors.

This error doesn't get raised when running with vite, (but I only use the table for types so I'm not sure if that is tree-shaking related) - but it does consistently happen in my jest testing (using both `node` & `jsdom`)

My typescript version is `5.6.3`, and tsconfig.json is:

```
{
"compilerOptions": {
"module": "commonjs",
"jsx": "react",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2018",
"types": ["jest"],
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"paths": {
"@/*": ["src/*"]
},
"incremental": true,
"skipLibCheck": true,
"esModuleInterop": true,
"strictNullChecks": true,
"strictBindCallApply": true
},
"exclude": ["cypress.config.ts", "cypress", "node_modules"]
}
```

I had a poke around my node_modules and it looked like it should work, so I'm completely stumped here

Contributor guide

Open the contributing guide

Research direction

Start with the reported src/dbSchema.ts import and the drizzle-orm/pg-core.uuid usage, then reproduce the failure in the Jest tests under both node and jsdom using drizzle-orm 0.38.2, drizzle-kit 0.30.1, and TypeScript 5.6.3. Compare the Jest behavior with the working Vite run; done means the uuid import no longer throws while the schema is consumed by the client tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, typescript
Domain
databases, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.