S
Supabase2mo ago
Maher

Vercel is charging for supabase middleware function (update session), any workaround?

Hi, 90% of my vercel costs are coming from the supabase middleware, how can I fix it?
No description
4 Replies
tomaspozo
tomaspozo2mo ago
I believe this is normal, since the middleware is a NextJS/Vercel feature. It does run Supabase auth code, but is not a Supabase functionality.
Maher
MaherOP2mo ago
would it achieve the same funcitonality if instead of middlewere I do it in layout?
tomaspozo
tomaspozo2mo ago
I don't think so, since Supabase auth needs to set cookies on your request, this is only supported on middleware or api routes if I'm not mistaken. Better to check the nextjs docs...
Maher
MaherOP2mo ago
do you know how to stop these logs? AuthApiError: Invalid Refresh Token: Refresh Token Not Found at dk (.next/server/src/middleware.js:33:29611) at async dm (.next/server/src/middleware.js:33:30585) at async dl (.next/server/src/middleware.js:33:29995) at async c (.next/server/src/middleware.js:33:66145) at async (.next/server/src/middleware.js:33:66408) { __isAuthError: true, status: 400, code: 'refresh_token_not_found' I can't seems to be able to catch them, does supabase log them internally?

Did you find this page helpful?