next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

The adapter-drizzle adapter fails to compile the cloudflare Pages environment when using cloudflare D1

Open tianlelyd opened this issue 7 months ago • 4 comments

Adapter type

@auth/drizzle-adapter

Environment

pnpx envinfo --system --binaries --browsers --npmPackages "{next,react,next-auth,@auth/*}"
Packages: +1
+
Progress: resolved 1, reused 0, downloaded 1, added 1, done

  System:
    OS: macOS 15.0
    CPU: (8) arm64 Apple M1 Pro
    Memory: 189.94 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.14.0 - /opt/homebrew/opt/nvm/versions/node/v20.14.0/bin/node
    npm: 10.7.0 - /opt/homebrew/opt/nvm/versions/node/v20.14.0/bin/npm
    pnpm: 9.6.0 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 126.0.6478.183
    Edge: 126.0.2592.113
    Safari: 18.0
  npmPackages:
    @auth/d1-adapter: ^1.4.1 => 1.4.1
    @auth/drizzle-adapter: ^1.4.1 => 1.4.1
    next: ^14.2.0 => 14.2.5
    next-auth: 5.0.0-beta.19 => 5.0.0-beta.19
    react: ^18 => 18.3.1

Reproduction URL

https://github.com/tianlelyd/drizzle-adapter-d1-test.git

Describe the issue

When using nextjs+drizzle+auth.js+adapter-drizzle, local testing works fine, but when compiling with pnpx @cloudflare/next-on-pages@1, an error occurs indicating that "getRequestContext is being called at the top level of a route file, this is not supported". However, I am not actually calling getRequestContext() at the top level.

How to reproduce

runpnpm run pages:build

Expected behavior

It should not prompt「getRequestContext` is being called at the top level of a route file, this is not supported」

tianlelyd avatar Jul 22 '24 12:07 tianlelyd