Using drizzle postgres with trpc in Next.js app
I'm getting the following error with the below code:
Module not found: Can't resolve 'dns'
. For some reason, my Next.js app is trying to load drizzle
on the client where it doesn't have access to Node modules. Has anyone ever run into this before?
2 Replies
You are probably importing formRouter in client code. This whole file is only for the server, except for the FormRouter type, that’s the only thing that can be imported in a client file
I agree, although I've exhaustively run through the trail of imports and don't see a clear reason 🤔
Is there a good example repo that combines trpc and drizzle in a next.js app?
Ah! I had
export const runtime = "edge"
instead of "nodejs
" in my /api/trpc/[trpc]/route.ts.
Hope this helps anyone that runs into this issue in the future 🙂