Skip to content

[BUG] NextAuth errors with [unenv] crypto.createCipheriv is not implemented yet! #206

@RUNFUNRUN

Description

@RUNFUNRUN

cloudflare/workerd#3277 (comment)

Describe the bug

When next-auth is used and next-auth related functions are executed, the following error occurs.

[wrangler:err] TypeError: Cannot assign to read only property 'cache' of object '#<eA>'
    at new CustomRequest (file:///Users/runfunrun/projects/test/opennext-cf/.open-next/server-functions/default/handler.mjs:20:18)
    at new $ (file:///Users/runfunrun/projects/test/opennext-cf/.open-next/middleware/handler.mjs:797:62)
    at o5 (file:///Users/runfunrun/projects/test/opennext-cf/.open-next/middleware/handler.mjs:5655:16)
    at so (file:///Users/runfunrun/projects/test/opennext-cf/.open-next/middleware/handler.mjs:5797:19)
    at Object.handler (file:///Users/runfunrun/projects/test/opennext-cf/.open-next/middleware/handler.mjs:5782:20)
    at null.<anonymous> (file:///Users/runfunrun/projects/test/opennext-cf/.open-next/middleware/handler.mjs:1268:174)
    at Object.wrap (file:///Users/runfunrun/projects/test/opennext-cf/.open-next/middleware/handler.mjs:1194:20)
    at null.<anonymous> (file:///Users/runfunrun/projects/test/opennext-cf/.open-next/middleware/handler.mjs:1266:276)
    at null.<anonymous> (file:///Users/runfunrun/projects/test/opennext-cf/.open-next/middleware/handler.mjs:1106:25)
    at i2.with (file:///Users/runfunrun/projects/test/opennext-cf/.open-next/middleware/handler.mjs:6421:25)

Steps to reproduce

  1. clone this repository https://github.com/RUNFUNRUN/opennext-cf
  2. install packages
bun i
  1. copy env
cp sample.env .env

(Environment variables can be reproduced as in the sample.)
4. run preview

bun run preview
  1. open http://localhost:8787/
    If I try deleting middleware.ts, I can access http://localhost:8787/ , but when I press the Sign In button, I get the same error.

Expected behavior

next-auth works

@opennextjs/cloudflare version

0.3.2

Wrangler version

3.99.0

next info output

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Nov 14 18:15:21 PST 2024; root:xnu-11215.41.3~13/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 12
Binaries:
  Node: 23.5.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 9.14.2
Relevant Packages:
  next: 15.1.3 // Latest available version is detected (15.1.3).
  eslint-config-next: 15.1.3
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.2
Next.js Config:
  output: N/A

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions