drizzle-team / drizzle-team/drizzle-orm

[BUG]: Build hangs when prerendering a page using Drizzle ORM with postgres-js

Open
#4,420 0 comments 0 reactions 0 assignees View on GitHub
bug
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

_No response_

### Describe the Bug

> What is the undesired behavior?

The build hangs for a long time (30 minutes and more).

> What are the steps to reproduce it?

I could make a minimal reproduction, but you can just create a new analogjs app (I haven't tested with other frameworks), prerender a page that has an api call (which uses a drizzle query).

> What is the desired result?

For the build to not hang for a long time.

> Other remarks:

[This](https://stackoverflow.com/questions/77236276/does-drizzle-provide-an-api-to-close-database-connection) is probably related.

Currently my solution is to provide an `idle_timeout` with postgres:
```
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';

const client = postgres('DATABASE_URL', {
idle_timeout: 20,
});
export const db = drizzle(client);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.