NextJS Build Fail with createAuthClient
My nextjs build is failing when calling createAuthClient from within Middleware. When I remove it, error is gone.

4 Replies
You are not supposed to create authClient and use it there ...it got a client hooks with it which doesn't work on middleware or server as well
Instead pass your betterAuth instance
Either way, even this won't work:
.
Solution
ok solved
I swapped the
import { betterFetch } from 'better-auth/react';
to the import { betterFetch } from '@better-fetch/fetch';