Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: NullReferenceException on update query with Xata #1750

Closed
realmikesolo opened this issue Jan 4, 2024 · 1 comment
Closed

[BUG]: NullReferenceException on update query with Xata #1750

realmikesolo opened this issue Jan 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@realmikesolo
Copy link
Collaborator

What version of drizzle-orm are you using?

^0.29.3

What version of drizzle-kit are you using?

^0.20.2

Describe the Bug

Attempt to update a row in the database using the .update() method.

const result = await db
    .update(usersTable)
    .set({ name: 'John' })
    .where(eq(usersTable.id, 'rec_cmbfbjkq82v9bp6r3mfg'));

The update operation is successfully executed, changing the specified field in the database, but it throws an error:

/node_modules/@xata.io/drizzle/src/session.ts:66
      Object.keys(records[0]!).map(
             ^
TypeError: Cannot convert undefined or null to object

However, if I add .returning() method to the query, it will be successfully executed without throwing any errors.

const result = await db
    .update(usersTable)
    .set({ name: 'John' })
    .where(eq(usersTable.id, 'rec_cmbfbjkq82v9bp6r3mfg'))
    .returning();

Expected behavior

The update operation should be executed successfully without throwing any errors.

Environment & setup

@xata.io/client: "^0.28.3",
@xata.io/drizzle: "^0.0.14"

@realmikesolo realmikesolo added the bug Something isn't working label Jan 4, 2024
@realmikesolo realmikesolo changed the title [BUG]: NullReferenceException on update query in Xata [BUG]: NullReferenceException on update query with Xata Jan 5, 2024
@realmikesolo
Copy link
Collaborator Author

Closed, as related to xataio/client-ts#1315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant