Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing passport-saml fails on node v20.6.0 #879

Closed
LaurensRietveld opened this issue Sep 8, 2023 · 3 comments · Fixed by #880
Closed

Importing passport-saml fails on node v20.6.0 #879

LaurensRietveld opened this issue Sep 8, 2023 · 3 comments · Fixed by #880

Comments

@LaurensRietveld
Copy link
Contributor

LaurensRietveld commented Sep 8, 2023

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
Copy link

github-actions bot commented Dec 8, 2023

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

@github-actions github-actions bot added the stale label Dec 8, 2023
@LaurensRietveld
Copy link
Contributor Author

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

@github-actions github-actions bot removed the stale label Dec 9, 2023
Copy link

github-actions bot commented Mar 9, 2024

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

@github-actions github-actions bot added the stale label Mar 9, 2024
cjbarth added a commit that referenced this issue Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant