NuxtN
Nuxt9mo ago
2 replies
mrk

API Request errors for better-auth on Cloudflare Workers

Hey! Has someone gotten
better-auth
to work on cloudflare workers? I am trying to deploy a Nuxt 4 application (via NuxtHub) to cloudflare workers, deployment works, but
better-auth
fails on requests to API endpoints, despite it working flawlessly in development, so this must be cloudflare-specific issue. I consistently get:

CLIENT ERROR: POST https://app.netzo.dev/api/auth/sign-up/email 500 (Internal Server Error)

SERVER ERROR: SERVER_ERROR: TypeError: Cannot read properties of undefined (reading 'includes')

I am using better-auth-nuxt, I feel this might be related to missing ENV VARS in production, can anyone share any insight? I've tried everything which comes to mind already to no avail.

I am setting DATABASE_URL to Supabase's direct connection string, which worked previously when deploying to Cloudflare Pages, but same deployment to Cloudflare Workers (via nuxt/
nitro
preset cloudflare-durable is failing despite the env variable being properly set in the cloudflare console.
Was this page helpful?