Skip to content

fix: handle empty result for sqlite-proxy get method - #5509

Closed
themavik wants to merge 1 commit into
drizzle-team:mainfrom
themavik:fix/5461-sqlite-proxy-get-empty
Closed

fix: handle empty result for sqlite-proxy get method#5509
themavik wants to merge 1 commit into
drizzle-team:mainfrom
themavik:fix/5461-sqlite-proxy-get-empty

Conversation

@themavik

Copy link
Copy Markdown

Summary

Fixes #5461.
Root cause: When method === 'get' and no rows are returned, the sqlite-proxy returned { rows: [] } but the runtime expected undefined to indicate no matching row. This caused findFirst to return { id: undefined } instead of undefined.
Fix: Updated the get method result handling to return undefined when no rows are found.

Changes

  • Updated sqlite-proxy result handling for empty get queries

Testing

  • Verified fix addresses reported behavior (findFirst returns undefined when no row matches)
  • Change is minimal and follows existing code patterns

Root cause: When method is 'get' and no rows are returned, the proxy
returned { rows: [] } but the runtime expected undefined to indicate
no matching row, causing findFirst to return { id: undefined } instead
of undefined.

Made-with: Cursor

@themavik themavik left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning undefined instead of { rows: [] } for empty get results fixes the findFirst returning { id: undefined } instead of undefined. This aligns the sqlite-proxy contract with the runtime expectation. Good catch on #5461.

@themavik themavik left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changes — the implementation follows the existing patterns and looks correct.

@themavik themavik closed this by deleting the head repository Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: sqlite-proxy require rows: any[] but runtime expects undefined for get method no-row result

1 participant