panva / openid-client

OAuth 2 / OpenID Connect Client API for JavaScript Runtimes
MIT License
1.83k stars 392 forks source link

LRU is not a constructor #693

Closed v0id-4lpz closed 1 month ago

v0id-4lpz commented 1 month ago

https://github.com/panva/node-openid-client/blob/7d3471ff17d5cdf3b3ee1bfd1dec7c0a7a7321d8/lib/helpers/request.js#L8

Hi, i have this error on my Nuxt project,

I use sidebase/nuxt-auth with nextauthjs/next-auth

 ERROR  [worker reload] [worker init] LRU is not a constructor                                                                   19:08:42  

  at Object.<anonymous> (node_modules\openid-client\lib\helpers\request.js:62:16)
  at Module._compile (node:internal/modules/cjs/loader:1376:14)
  at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
  at Module.load (node:internal/modules/cjs/loader:1207:32)
  at Module._load (node:internal/modules/cjs/loader:1023:12)
  at Module.require (node:internal/modules/cjs/loader:1235:19)
  at require (node:internal/modules/helpers:176:18)
  at Object.<anonymous> (node_modules\openid-client\lib\client.js:25:17)
  at Module._compile (node:internal/modules/cjs/loader:1376:14)
  at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)

Maybe use instead

const { LRUCache } = require('lru-cache')
const LRU = new LRUCache()
panva commented 1 month ago

I don't quite know what's at play in your environment / setup / deployment.

$ node -p "const LRUCache = require('lru-cache'); LRUCache" 
[class LRUCache]
$ node -p "const { LRUCache } = require('lru-cache'); LRUCache"
undefined