how do i use Drizzle?
I'm trying to use Drizzle db on the server only and its giving me "Uncaught TypeError: promisify is not a function" in the browser.
this is what
lib/db
looks like
40 Replies
i think you're missing a
use server
lol, it's trying to run the query on the clientin
cache
?yeah
same error
where'd u put it?
and i also put this in config
didn't work
oh definitely remove those
saw it in prisma example lol https://github.com/solidjs/solid-start/blob/main/examples/with-prisma/app.config.ts
no idea why they do that
removing it didn't fix tho...
try deleting
node_modules/.vinxi
and restart the dev server, and remove the migrate
calli deleted
node_modules/.vinxi
, but what is the migrate
call?
oh in drizzle
ok
did it, it didn't workI had some issues with prisma as well, moving the data functions (
cache
) to a different file made them go away
(make the whole file "use server")ah you wouldn't want the whole file to be
use server
if you're calling cache
in there but yea a separate file might helpeven if i get it work, this is honestly not as straightforward as sveltekit.
in sveltekit you keep all your stuff in a file designed for server,
+page.server.ts
so its much more easy and noob-friendly
doing that i got |- Error: Export from a 'use server' module must be a function
are you doing
or
i'd say this is kinda by design - start & router try to be fairly hands off. you're given primitives to build how you want
if you're after a simpler (and more stable lol) dx then sveltekit is defs a better option
i'm doing this
i like solid because of the <Suspense> and cache architecture
remove the top level
use server
- you can only use that if all the exports are plain functionsso should i create a getDb function and return the drizzle db?
no just remove the top level
use server
ok and then?
it doesn't work
what did you do about your original
getData
function
its the same problem
i just changed my cache function xd
ah right
yeah i'm not quite sure, that's really weird
are u able to share the source?
repo?
yea
my first message has a full repro
does it not bug for u?
i use drizzle and start without ssr and it's fine. a full repro would be something i can download and run
cache + server function in one file
db in another file
produces a different error but it's fine
🤣
did u find any solution?
"use serve" <- typo 🤓
yea ik it still gives that error haha
that is my solution, that async_hooks error isn't that important
😐
are u being sarcastic
bc those modules are leaking into client
and making the bundle bigger
put the server functions and cache/action uses in separate files
create pr in the repo and i'll merge
i mean you've got the solution, implement it in your app nevermind the repro
cool
it works
i'll close this post