sqlite http-proxy can't handle undefined values on `.get()` ?

Hi drizzle team! I've been playing with the http-proxy plugin to see how it works, and I hit a funny edge case trying to handle
undefined
values on get(). The docs show this barebones example to set up an http proxy:

const db = drizzle(async (sql, params, method) => {
  try {
    const rows = await axios.post('http://localhost:3000/query', { sql, params, method });
 
    return { rows: rows.data };
  } catch (e: any) {
    console.error('Error from sqlite proxy server: ', e.response.data)
    return { rows: [] };
  }
});


They, I attempted a .get() request for a value that doesn't exist in the database:

const email = await db.select().from(emails).where(eq(emails.email, 'fake@example.com')).get();

I tested the better-sqlite3 adapter and found email should return
undefined
(which doesn't match the type inference mind you!). But in the SQlite proxy, I get a much funnier result:

email = {
  id: undefined,
  email: undefined,
  submitted: Invalid Date
}


It seems it's trying to parse the value even when rows is an empty array in the adapter. Is there a way to return
undefined
for this case as in the better-sqlite adapter? Thanks!
Was this page helpful?