node-saml / passport-saml

SAML 2.0 authentication with Passport

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Importing @node-saml/passport-saml gives type error

lcundiff opened this issue · comments

When importing @node-saml/passport-saml, Typescript gives the following error:
namespace 'servestatic' has no exported member 'requesthandlerconstructor'.

I have made sure to install all dependencies and am using the newest versions of all package dependencies including Express.

To Reproduce

  1. npm i @node-saml/passport-saml
  2. add import { Strategy } from "@node-saml/passport-saml" to your code

Expected behavior
Should run without type error.

Environment

  • Node: 14
  • passport-saml: 4.0.4 (latest)
  • typescript : ^4.4.3
  • expression: 4.17.1
  • @types/express: "^4.17.3
  1. Preparations to try to reproduce your issue:
    node -v && npm -v
    
    v14.21.3
    6.14.18
    rm -rf /tmp/test
    mkdir /tmp/test
    cd /tmp/test
  2. Followed your issue reproduce instructions:
    npm init
    npm i @node-saml/passport-saml
    Resulting in addition to package-lock.json this:
    {
      "name": "test",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
        "@node-saml/passport-saml": "^4.0.4"
      }
    }
  3. Due not having any information what you had previously in package.json, package-lock.json or at your project ended up trying this: index.mjs
    import { Strategy } from "@node-saml/passport-saml";
    
    console.log(
      new Strategy(
        {
          path: "/login/callback",
          entryPoint:
            "https://openidp.feide.no/simplesaml/saml2/idp/SSOService.php",
          issuer: "passport-saml",
          cert: "fake cert", // cert must be provided
        },
        function (profile, done) { },
        function (profile, done) { }
      )  
    );
    command
    node index.mjs
    did not produce problems
  4. Not able to reproduce error.

top hit was:

Did you already investigate whether you can fix it with workaround(s) introduced at DefinitelyTyped issue?

@srd90 Thank you for looking into this and apologies for not attaching package.json and other code. I was using the example code, so it is the same as you have in your example there. However, I had tested the error when erasing all of my code and only including the import statement, and the error still existed, so it is not due to the implementation.

Did you have typescript installed? I will add that to the environment above to be more explicit with Typescript being required for the error to occur.

I will look into the DefinitelyTyped issue and see if that resolves it and follow up here either way in a couple of days. Thank you again.

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

This issue was closed because it has been inactive for 30 days since being marked as stale.

@lcundiff , did you have any followup on this? If so, please let us know and we can reopen.