While inserting a row on libsql and calling get() on it, without using the returning(), the function normalizeRow is passed a undefined.
This inserts the record but also throws an error, which in the end is caught by API's try catch, and results in 500.
function normalizeRow(obj) {
// The libSQL node-sqlite3 compatibility wrapper returns rows
// that can be accessed both as objects and arrays. Let's
// turn them into objects what's what other SQLite drivers
// do.
return Object.keys(obj).reduce((acc, key) => {
if (Object.prototype.propertyIsEnumerable.call(obj, key)) {
acc[key] = obj[key];
}
return acc;
}, {});
}
Expected behavior
Inserting rows on libsql should work.
Environment & setup
local development setup, but also tried this on turso.
You are supposed to only call get() if you're expecting one result. This error is intended behavior. I think you can use the .run() method if you know nothing is going to be returned.
What version of
drizzle-orm
are you using?^0.28.2
What version of
drizzle-kit
are you using?^0.19.12
Describe the Bug
While inserting a row on libsql and calling
get()
on it, without using thereturning()
, the functionnormalizeRow
is passed a undefined. This inserts the record but also throws an error, which in the end is caught by API's try catch, and results in 500.Expected behavior
Inserting rows on libsql should work.
Environment & setup
local development setup, but also tried this on turso.