drizzle-team / drizzle-team/drizzle-orm

[BUG]: Return value of the transaction will be an empty object.

Open
#4,202 4 comments 6 reactions 0 assignees View on GitHub
bug db/sqlite driver/durable-objects priority
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

When using a transaction in SQL for Durable Object, the return value is an empty object, regardless of the return value of the callback. There is also an inconsistency with Typescript types.

It may work correctly if you fix the following two places.
https://github.com/drizzle-team/drizzle-orm/blob/53f578c11a77c7c086f9c3ed897afdebce7ed6e6/drizzle-orm/src/durable-sqlite/session.ts#L70-L73

```typescript
const result = this.client.transactionSync(() => transaction(tx));
return result;
```

https://github.com/drizzle-team/drizzle-orm/blob/53f578c11a77c7c086f9c3ed897afdebce7ed6e6/drizzle-orm/src/durable-sqlite/session.ts#L89-L91

```typescript
const result = this.session.transaction(() => transaction(tx));
return result;
```

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.