Saif
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.
7 replies
Postgres: Transaction not honouring previous queries
Hi, I have a table with unique constraint on some columns.
In a transaction, I am deleting all the entries from the table and then I am inserting new entries. However, I am getting
error: duplicate key value violates unique constraint "xxxxx_key"
I only want the deletion to happen if the insertion is successful, and that's why I tried using transaction. However, the transaction seems to work in a different way than I thought.
Can someone help me in understanding this behaviour and what's the solution to this?7 replies