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

NullReferenceException on update query using Drizzle and Xata #1315

Closed
realmikesolo opened this issue Jan 8, 2024 · 0 comments
Closed

NullReferenceException on update query using Drizzle and Xata #1315

realmikesolo opened this issue Jan 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@realmikesolo
Copy link

Describe the bug

Attempt to update a row in the database using the .update() method, but it throws an error even after update operation is successfully executed.

To Reproduce

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.

Software version

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

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

2 participants