Issue with ReadableStream is locked or disturbed error and Google Sign-In using Better Auth
Hi everyone!
I'm using Better Auth (version 0.5.2-beta.16) for a project, and I've encountered a blocking issue during Google sign-in integration.
When trying to sign in with Google, the backend throws the following error:
Here’s the full log output:
This error happens when calling
I'm using Better Auth (version 0.5.2-beta.16) for a project, and I've encountered a blocking issue during Google sign-in integration.
My setup:
- Backend: Express with Drizzle ORM and Better Auth for authentication.
- Frontend: React using
createAuthClientfrom Better Auth. - Database: SQLite (with Drizzle ORM).
- Google OAuth for authentication.
When trying to sign in with Google, the backend throws the following error:
Here’s the full log output:
This error happens when calling
authClient.signIn.social({ provider: 'google', callbackURL: '/profile' }) on the frontend.What I've tried:
- Checked that the Google OAuth credentials are correct.
- Ensured that the
/api/auth/*routes are properly handled in the backend usingtoNodeHandler. - Implemented CORS for requests between
localhost:3000(frontend) andlocalhost:5000(backend). - Verified that session middleware is correctly applied on the backend.
- **Frontend (React)**:```javascriptconst authClient = createAuthClient({ baseURL: 'http://localhost:5000/api/auth'});const signInWithGoogle = async () => { await authClient.signIn.social({ provider: 'google', callbackURL: '/profile' });};```
- **Backend (Express)**:```javascriptapp.all('/api/auth/*', (req, res, next) => { console.log('Request body:', req.body); next();}, toNodeHandler(auth));```