While deploying - A Node.js API is used (process.exit at line: 1451) which is not supported in..
While deploying my next.js app on vercel it's giving this error
./node_modules/better-auth/dist/chunk-62MWLLEG.js
A Node.js API is used (process.exit at line: 1451) which is not supported in the Edge Runtime.
Learn more: https://nextjs.org/docs/api-reference/edge-runtime
8 Replies
better auth doesn't work on edge
How to resolve the issue? I am deploying in vercel with better-auth as authentication
most likely your either setting the runtime to edge in a route with
export const runtime = 'edge';
along with using better auth which doesnt work.
or your using better-auth in you middleware.ts
@joseph013318 Read up what the edge runtime is and also how nextjs middleware worksmost likely either a export const runtime = 'edge';Better Auth doesn't work on edge.
I know? Im saying that mostly likely the issue?
I missunderstood you, sorry.
@Ping @lonelyplanet Yes using it in middleware. This is the exact code I used as in the better-auth docs
https://www.better-auth.com/docs/integrations/next#middleware
I need protected routes with auth! How do I solve the issue?
Next.js integration | Better Auth
Integrate Better Auth with Next.js.
Care to share your middleware?