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

TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received undefined #50

Open
dragomir-enachi-ibm opened this issue Oct 28, 2022 · 3 comments

Comments

@dragomir-enachi-ibm
Copy link

dragomir-enachi-ibm commented Oct 28, 2022

Migrating an application from Node 16 to Node 18, running the app tests - they fail with this:

TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received undefined at new NodeError (node:internal/errors:393:5) at Function.byteLength (node:buffer:740:11) at safeCompare (/Users/username/IdeaProjects/project/node_modules/express-basic-auth/index.js:9:33) at staticUsersAuthorizer (/Users/username/IdeaProjects/project/node_modules/express-basic-auth/index.js:42:43) at authMiddleware (/Users/username/IdeaProjects/project/node_modules/express-basic-auth/index.js:61:18) at Layer.handle [as handle_request] (/Users/username/IdeaProjects/project/node_modules/express/lib/router/layer.js:95:5) at next (/Users/username/IdeaProjects/project/node_modules/express/lib/router/route.js:144:13) at Route.dispatch (/Users/username/IdeaProjects/project/node_modules/express/lib/router/route.js:114:3) at Layer.handle [as handle_request] (/Users/username/IdeaProjects/project/node_modules/express/lib/router/layer.js:95:5) at /Users/username/IdeaProjects/project/node_modules/express/lib/router/index.js:284:15 at Function.process_params (/Users/username/IdeaProjects/project/node_modules/express/lib/router/index.js:346:12) at next (/Users/username/IdeaProjects/project/node_modules/express/lib/router/index.js:280:10) at expressInit (/Users/username/IdeaProjects/project/node_modules/express/lib/middleware/init.js:40:5) at Layer.handle [as handle_request] (/Users/username/IdeaProjects/project/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/Users/username/IdeaProjects/project/node_modules/express/lib/router/index.js:328:13) at /Users/username/IdeaProjects/project/node_modules/express/lib/router/index.js:286:9 at Function.process_params (/Users/username/IdeaProjects/project/node_modules/express/lib/router/index.js:346:12) at next (/Users/username/IdeaProjects/project/node_modules/express/lib/router/index.js:280:10) at query (/Users/username/IdeaProjects/project/node_modules/express/lib/middleware/query.js:45:5) at Layer.handle [as handle_request] (/Users/username/IdeaProjects/project/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/Users/username/IdeaProjects/project/node_modules/express/lib/router/index.js:328:13) at /Users/username/IdeaProjects/project/node_modules/express/lib/router/index.js:286:9 at Function.process_params (/Users/username/IdeaProjects/project/node_modules/express/lib/router/index.js:346:12) at next (/Users/username/IdeaProjects/project/node_modules/express/lib/router/index.js:280:10) at Function.handle (/Users/username/IdeaProjects/project/node_modules/express/lib/router/index.js:175:3) at Function.handle (/Users/username/IdeaProjects/project/node_modules/express/lib/application.js:181:10) at Server.app (/Users/username/IdeaProjects/project/node_modules/express/lib/express.js:39:9) at Server.emit (node:events:513:28) at parserOnIncoming (node:_http_server:1068:12) at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17)

Still looking to find the root cause.

@lorenzobalzani
Copy link

Follow

@LionC
Copy link
Owner

LionC commented Sep 29, 2023

For me, tests run under Node 18.18 - can you give me more details to reproduce?

@almunnings
Copy link

Observed this error with an empty users config. eg:

const auth = {
  challenge: true,
  users: {
    [null]: null
  }
}

My fix was... adding credentials 🗡️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants