node-saml / passport-saml

SAML 2.0 authentication with Passport

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Importing passport-saml fails on node v20.6.0

LaurensRietveld opened this issue · comments

Summary

We've just encountered the issue that importing (not running, but importing) passport-saml throws an error when:

  • Node 20.6.0 is used
  • you're importing passport-saml into an ESM module

Importing passport-saml will throw this error:

class MultiSamlStrategy extends strategy_1.AbstractStrategy {
                                           ^

TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (~/saml/node_modules/@node-saml/passport-saml/lib/multiSamlStrategy.js:6:44)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (~/saml/node_modules/@node-saml/passport-saml/lib/index.js:21:29)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)

Node.js v20.6.0

Using an older node version works fine, and importing passport-saml into a CJS module works fine as well.

To Reproduce

See here for an MWE: https://github.com/LaurensRietveld/saml-mwe and follow the readme:

  • Make sure you're running node 20.6.0
  • Run yarn
  • Run node ./test.cjs. This works fine
  • Run node ./test.js. This throw the error above

Probable cause

I expect this be caused by circular reference issue (given that this results in undefined imports). I noticed two circular references:

Environment

  • Node.js version: 20.6.0
  • passport-saml version: 4.0.4

This issue is stale because it has been open for 90 days with no activity.

this is still an issue (and PR still fixes this issue)

This issue is stale because it has been open for 90 days with no activity.