Unable to use postgres in middleware
Unanswered
Cape lion posted this in #help-forum
Cape lionOP
See title, not much else to report apart from it doesn't work due to various limitations on the edge runtime. Is there a workaround?
7 Replies
Cape lionOP
For reference, we host our own postgres and don't want to use a different host like Vercel Database
Why are you trying to run pg in your middleware is my first question @Cape lion
@Arinji Why are you trying to run pg in your middleware is my first question <@843135686173392946>
Cape lionOP
Need to validate/renew sessions in cookies
Make an api route, and call that from your middleware
Cape lionOP
🥲 then i'll have to make that protected somehow too, i guess
@Cape lion See title, not much else to report apart from it doesn't work due to various limitations on the edge runtime. Is there a workaround?
you can deploy a ws proxy in front of your db instance to access the data in the edge runtime https://github.com/neondatabase/serverless/blob/main/DEPLOY.md
Cape lionOP
Ooh, didn't know that, I'll look into it and mark as a solution if it fits my needs 🙂