Skip to content

handler error when running benchmark #1965

Open
@jcreigno

Description

@jcreigno
  • Used appropriate template for the issue type
  • Searched both open and closed issues for duplicates of this issue
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions