drizzle-team / drizzle-team/drizzle-orm

[BUG]: `Update` do not work on Cloudflare workers `waitUntil` normally

Open
#1,342 0 comments 2 reactions 0 assignees View on GitHub
bug qb/crud
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

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

0.28.6

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

_No response_

### Describe the Bug

Code

```ts
ctx.ec.waitUntil(
ctx.db
.update(Users)
.set({
otp: null,
})
.where(eq(Users.id, user.id)),
)
```
The update will not run

But When I try

```ts
ctx.ec.waitUntil(
(async () => {
return await ctx.db
.update(Users)
.set({
otp: null,
})
.where(eq(Users.id, user.id))
})(),
)
```

or

```ts
ctx.ec.waitUntil(
ctx.db
.update(Users)
.set({
otp: null,
})
.where(eq(Users.id, user.id))
.execute(),
)
```

It works, but why? Can someone tell me what is the magic behind it?

### Expected behavior

I expected to use `update` as normal when combine with `waitUtil`

### Environment & setup

Cloudflare worker + neon serverless database

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.