How to use kysely in edge runtime (like NextJS 14 middleware)?
Error: The edge runtime does not support Node.js 'crypto' module.
Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime
Full log: https://pastebin.com/JSXBNRxv
I need to verify if the user has access to the resources they are trying to visit, the middleware seemed to be the best place for this. However, I am not able to query the database as it is throwing the above error.
Pastebin
web:dev: âš ../../node_modules/.pnpm/[email protected]/node_modules/pg/lib/...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
4 Replies
Kysely doesn't import the crypto module.
That error comes from somewhere else.
It's from the
pg
package:
Hey 👋
Try using
kysely-postgres-js
instead of the core dialect.Sure, let me try