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

fix: support node v18

Open ghermeto opened this issue 3 years ago • 5 comments

  • fix Request.prototype.closed() clash with new Reader.closed (fixes GH-1888)
  • fix IPv6 url by supporting new server.address().family format
  • add node 18 to GH Actions

What?

Backward compatible change to support Node v18.

Why?

Node v18 breaking changes:

  • Added a Reader.closed getter that clashes with the Request.prototype.closed() patch.
  • Changed the data type of server.address().family from string (IPv6) to a number (6)

Drawbacks

I don't particularly like this change because it will be unexpected to people using Node18 that closed will be a method and not a getter. I would prefer to limit Restify 8.x to Node 17 and make a breaking change for 9.x by changing the method name to isClosed() or better yet, drop the method in favor of patching a getter for node v10~v17.

@restify/current-core please advise on the preferred action plan.

ghermeto avatar May 08 '22 02:05 ghermeto

@DonutEspresso thoughts?

ghermeto avatar May 12 '22 21:05 ghermeto

Is there is a roadmap for reviewing and merging node18 support? How can I help?

petershaw avatar Aug 09 '22 21:08 petershaw

Are there any updates on this PR? We are blocked from a security update until this is solved.

jcdalton2201 avatar Sep 01 '22 13:09 jcdalton2201

cc/ @mmarchini @wesleytodd

Can you advise what is the preferred path to add support to Node 18?

ghermeto avatar Sep 15 '22 17:09 ghermeto

FWIW here's another ping. We'd love to be on node 18, but can't start up without this patch.

ben avatar Sep 21 '22 17:09 ben

One alternative we're considering is to just remove the closed monkey patch and let restify codebase as well as users rely on connectionState instead: https://github.com/restify/node-restify/pull/1929. We might want to add a deprecation warning first though

mmarchini avatar Nov 10 '22 23:11 mmarchini

Closing since we're moving forward with #1929

mmarchini avatar Nov 15 '22 21:11 mmarchini