restify / restify/node-restify

handler error when running benchmark

Open
#1,965 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.7k
Forks
975
Avg merge
1d 6h
Merged PRs (30d)
5

Description

  • 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with benchmark/benchmarks/response-json.js, identified in the stack trace, and run make benchmark on Node.js 18 or 20 to reproduce the handler assertion. Check the benchmark handlers implicated by the command; the work is done when the benchmark completes without handler errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
performance
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.