Type Error when inserting into table
I'm getting as error when trying to insert into a table using:
I can run the insert successfully in Drizzle Runner. The error:
4 Replies
Probably going to need more information for this, the type error isn't that informative. How are you exporting/importing
db
into your file? I'd start thereexport const db = drizzle('./src/lib/db/sqlite.db');
import db from '$lib/db/db';
For context, $lib
is a built-in SvelteKit alias. It works elsewhere in my project. I'm able to successfully query data.I'm not too familiar with SvelteKit so maybe someone else can speak more to that, but there is some kind of issue happening with the way
db
is imported for sure (just based on the error message). It might be something to do with the way SvelteKit uses that alias (maybe an issue with server/client boundaries?) but like I said I'm not familiar with SvelteKitOk, fixed it. The alias wasn't the probably, it's just rendered to a plaintext filepath. The issue was
import db
should have been import { db }
.
Always the little things...