Next.js Discord

Discord Forum

Error querying database in a middleware

Unanswered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
I'm using Supabase, Drizzle and Postgres. I have a use case where I have a middleware that checks if user is authenticated (I'm using the auth system from supabase), that's working fine. Then I have two pages '/account/profile', '/account/company', so i want to use a middleware to see if the data in the tables 'user' and 'user_company' are comleted, if not I want to redirect the user to '/set-up' . I can check that a in '/account/profile.tsx' and '/account/company.tsx', but I think would be a better practice to do it in a middleware. But I'm having this issue

0 Replies