NeonN
Neon12mo ago
1 reply
ripe-gray

XMLHttpRequest is not defined

I'm trying to deploy my nextjs-hono-backend application on cloudflare pages.
im using drizzle adapter with neon-postgres in better-auth
It builds successfully but on preview, it returns the following errors in the terminal

✨ Compiled Worker successfully
✨ Parsed 1 valid header rule.
Using vars defined in .dev.vars
⎔ Starting local server...
[wrangler:inf] Ready on http://localhost:8788

✘ [ERROR] Better Auth:error  INTERNAL_SERVER_ERROR NeonDbError: Error connecting to database: XMLHttpRequest is not defined

...

✘ [ERROR] Better Auth:error  INTERNAL_SERVER_ERROR [f [BetterCallAPIError]: API Error: INTERNAL_SERVER_ERROR Failed to get session] {

    status: 'INTERNAL_SERVER_ERROR',
    headers: Headers(0) { [immutable]: false },
    body: { message: 'Failed to get session', code: 'FAILED_TO_GET_SESSION' },
    [cause]: { message: 'Failed to get session', code: 'FAILED_TO_GET_SESSION' }
  }

[wrangler:inf] GET /api/auth/get-session 500 Internal Server Error (153ms)
[wrangler:inf] GET / 200 OK (194ms)

✘ [ERROR] ReferenceError: XMLHttpRequest is not defined

[wrangler:inf] GET /favicon-32x32.png 200 OK (20ms)
[wrangler:inf] GET /site.webmanifest 500 Internal Server Error (24ms)
✘ [ERROR] ReferenceError: XMLHttpRequest is not defined

[wrangler:inf] GET / 500 Internal Server Error (23ms)
✘ [ERROR] ReferenceError: XMLHttpRequest is not defined
Was this page helpful?