node-restify icon indicating copy to clipboard operation
node-restify copied to clipboard

handler error when running benchmark

Open jcreigno opened this issue 9 months ago • 0 comments

  • [x] Used appropriate template for the issue type
  • [x] Searched both open and closed issues for duplicates of this issue
  • [x] Title adequately and concisely reflects the feature or the bug

Restify Version: 11.1.0 Node.js Version: v18

Expected behaviour

benchmark should run without any errors.

Actual behaviour

When I run make benchmark I get an error on handlers:

$>make benchmark
...
⠋ Started head/response-json(node:725052) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

AssertionError [ERR_ASSERTION]: Handler [onRequest on GET /] is missing a third argument (the "next" callback) but is not an async function. Middleware handlers can be either async/await or callback-based.Callback-based (non-async) handlers should accept three arguments: (req, res, next). Async handler functions should accept maximum of 2 arguments: (req, res).
    at Chain.add (/home/jcreignou395/Public/node-restify/benchmark/node_modules/restify/lib/chain.js:79:16)
    at forEach (/home/jcreignou395/Public/node-restify/benchmark/node_modules/restify/lib/router.js:211:15)
    at Array.forEach (<anonymous>)
    at Router.mount (/home/jcreignou395/Public/node-restify/benchmark/node_modules/restify/lib/router.js:203:14)
    at Server.serverMethod [as get] (/home/jcreignou395/Public/node-restify/benchmark/node_modules/restify/lib/server.js:1779:33)
    at Object.<anonymous> (/home/jcreignou395/Public/node-restify/benchmark/benchmarks/response-json.js:15:8)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: 'Function',
  expected: 'AsyncFunction',
  operator: '=='
}

Node.js v18.18.0
make: *** [Makefile:70 : benchmark] Erreur 1

Repro case

Clean checkout from current master and run make benchmark with node v18.18. I also reproduce the issue with node v20.x

Cause

The next callbacks are missing.

Are you willing and able to fix this?

Yes. I have a PR ready if needed.

jcreigno avatar Nov 22 '23 17:11 jcreigno