(node:39372) [DEP0131] DeprecationWarning: The legacy HTTP parser is deprecated

http-parser-js should work via monkey-patching on Node v6-v11, and v13-14.

Node v12.x renamed the internal http parser, and did not expose it for monkey-patching, so to be able to monkey-patch on Node v12, you must run node --http-parser=legacy file.js to opt in to the old, monkey-patchable http_parser binding.

CC @storyteller do you know why the warning might still be showing up?

If we discount the use of http package then we will have to go more deeper into the code and see where else the old style is being used. When looking into pre-v1 code I think I came across at least one place where that was the case.

@jkuester @storyteller, this new issue is separate from the deprecation of the HTTP package.

With the release of Meteor 2.1.1, the node version is updated to Node 12.22.1. In Node 12.22.0, node started to display the deprecation warning for the “legact HTTP parser”

The legacy HTTP parser, selected by the --http-parser=legacy command line option, is deprecated with the pending End-of-Life of Node.js 10.x (where it is the only HTTP parser implementation provided) at the end of April 2021. It will now warn on use but otherwise continue to function and may be removed in a future Node.js 12.x release.

Meteor is using this npm package:

  • faye-websocket
    • which uses: websocket-driver
      • which uses: http-parser-js

http-parser-js seems to be overriding the default HTTP parser of node. But it is not possible in Node 12 (possible again for Node 14).

http-parser-js should work via monkey-patching on Node v6-v11, and v13-14.

Node v12.x renamed the internal http parser, and did not expose it for monkey-patching, so to be able to monkey-patch on Node v12, you must run node --http-parser=legacy file.js to opt in to the old, monkey-patchable http_parser binding.

Seems like there are a few ways to fix this:

  1. Band-aid long term solution: upgrade to Node 14
  2. Short term solution: update the command called by meteor to start node to add the parameter `–http-parser=legacy
  3. Long term solution: move away from the old http parser (seems to be through faye-websocket)
1 Like

Option #1 is already in works and there is already some work on #3 as well.

1 Like

Node 16 is out and it is mentioned that the binding to the legacy http parser has been removed.

https://nodejs.medium.com/node-js-16-available-now-7f5099a97e70

I think this will be tackled together with the Fibers issue, see:

Anyhow from those two I think we will see Node 16 in Meteor earliest in late 2022.

1 Like

As for option #2 the issue there is that it will not get rid of the deprecation warning.

1 Like

I have upgraded faye-websocket in two packages and that seemed to have killed the warning, so at least for the moment we are fine.

2 Likes

Confirming this fix. Thanks @storyteller

2 Likes