node-postgres uses crypto under the hood ?
Hello everyone, so I'm migrating from Prisma to Drizzle so I can use the NextJS's edge runtime
I'm trying to make a query inside my edge middleware and I get the following error:
The edge runtime does not support Node.js 'crypto' module.
I'm using node-postgress
as I've already mentioned
What are my options here ?10 Replies
I don't run my stuff on the edge so I'm not positive it would work, but you could try https://github.com/porsager/postgres
GitHub
GitHub - porsager/postgres: Postgres.js - The Fastest full featured...
Postgres.js - The Fastest full featured PostgreSQL client for Node.js and Deno - GitHub - porsager/postgres: Postgres.js - The Fastest full featured PostgreSQL client for Node.js and Deno
Hmm, I guess itβs the only option.
How is it in general ? Run into any problems using it ?
How is it in general ? Run into any problems using it ?
I haven't, the only downside is that Drizzle Studio doesn't support it as a driver yet, so if you plan on using Drizzle Studio you'll need to keep
pg
installed https://orm.drizzle.team/drizzle-studio/overview#prepare-config-fileMeet Drizzle Studio β DrizzleORM
Drizzle ORM | %s
postgres js has not yet published its fix to work with edge env π¦
https://discord.com/channels/1043890932593987624/1143421254678876271
I see. Thanks for the help Noah
Thank you Raphael too for the headsup, will save me quite a bit of time!
Or it has π€·ββοΈ https://github.com/porsager/postgres/pull/618
But last release is month ago π₯Ά
Yeah.. that's unlucky
What kind of solution did you go for ? I want to have middleware-like logic but without using the edge runtime.
I guess the paths are: 1. Create a custom middleware and therefore a custom server 2. Have your middleware call functions from other API routes that run on a normal nodeJS environment
I guess the paths are: 1. Create a custom middleware and therefore a custom server 2. Have your middleware call functions from other API routes that run on a normal nodeJS environment
I'm trying to solve the same issue, and I believe using the neon driver should work here
but I can't get that working locally
I would go for an API route yes.
But I mainly use Remix, so, I didn't get deeper into nextjs middleware.
Makes sense, thanks you again Raphael π