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

I’ve started getting this error on a fresh install of Meteor + vue

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

Seems to be related to the node.js changelog post HERE

Any ideas?

2 Likes

I have the same problem. Based on the stack trace it does not appear to be coming from modules I use. I think its the meteor core.

1 Like
2 Likes

I had the same thought initially as I have another project that swapped out the core HTTP.
Currently the basic vue project does not use the http package. I added jkuester:http and this error still shows on run:

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

There is something I’m missing here, please could you tell me where I’m going wrong:

  1. Created /packages directory in my project folder
  2. ran git clone https://github.com/jankapunkt/meteor-http.git inside /packages
  3. ran git checkout core-replacement
  4. in settings.json file created the follow env variable:
 "METEOR_PACKAGE_DIRS":"./packages/"

It’s not jkuester http package doing. That is a great transitional solution but even after adding it I still got the deprecation warning as you did. And even after converting most of my calls to node-fetch (which is what the jkuester package does), I still get it. I set trace-warnings and get a stack trace but it is not very helpful in locating the source of the call. I get this:

=> Started proxy.
(node:24797) [DEP0131] DeprecationWarning: The legacy HTTP parser is deprecated.
    at <anonymous>
    at internalBinding (internal/bootstrap/loaders.js:136:34)
    at process.binding (internal/bootstrap/loaders.js:113:14)
    at Object.<anonymous> (/home/shartman/.meteor/packages/ddp-server/.2.3.2.1jl3owp.wpsuf++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/websocket-driver/lib/websocket/http_parser.js:3:30)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Module.Mp._compile (/home/shartman/glo/dev/.meteor/local/build/programs/server/runtime.js:50:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Module.Mp.load (/home/shartman/glo/dev/.meteor/local/build/programs/server/runtime.js:15:31)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/shartman/.meteor/packages/ddp-server/.2.3.2.1jl3owp.wpsuf++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/websocket-driver/lib/websocket/driver/client.js:6:18)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Module.Mp._compile (/home/shartman/glo/dev/.meteor/local/build/programs/server/runtime.js:50:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
info: environment is development 3.3.1

Does anyone know who uses cjs helpers?

Have not tried the new branch. Maybe @jkuester can help

By the way, you need the package to be under the http folder.

The wanring is because Meteor checks for the package in general and does not take into account that it is a newer version or not. The branch actually is made so you don’t need to rename the name in package.js to http and just place it inside package or link to it from there.

Yeah, but in my case I was using your http package (which is awesome by the way) but subsequently moved to fetch, so it is not even in my bundle anymore. Nor do I have the http or request package as a direct dependency since I don’t call it anymore. The deprecation warning STILL occurs, from somewhere in the Meteor code (see stack trace above). If I understand you correctly, Meteor itself still uses it even though I do not, and that somehow I can replace this dependency with your package and the warning will go away? Or that there is a branch of Meteor that does this? Not sure exactly what I am supposed to do.

@rjdavid I did exactly what you suggest. I removed http and added jkuester:http. Then I rewrote all my uses with node-fetch. Then I removed jkuester:http. So there is theoretically no http package in my build. meteor list doesn’t show it

shartman@LAKEDEV:~/glo/dev$ meteor list --tree | grep request
shartman@LAKEDEV:~/glo/dev$ meteor list --tree | grep http
shartman@LAKEDEV:~/glo/dev$ meteor list --tree | grep parser

I removed all global npm packages and I still get the warning. I will be damned if I can figure out where it is coming from. All I have is the stack trace above. I pulled the repos and ag’ed a bit but that wasn’t helpful and I can’t figure out how to get the source maps for the repos into vscode.

That’s exactly the current situation now.

I’m in the same boat out here:

  • I’m using the fabulous jkeuster:http
  • I am not using the original http

Yet, I’m still seeing a warning (deprecation) message at start-up time:

[[[[[ C:\git\vxframe ]]]]]

=> Started proxy.
W20210414-10:42:07.571(-7)? (STDERR) (node:8584) [DEP0131] DeprecationWarning: The legacy HTTP parser is deprecated.
I20210414-10:42:09.479(-7)? meteor-emails utils.js sass *init* unconditionally returning node-sass
I20210414-10:42:10.961(-7)? startup.js (vx) VXFrame 1.4.4 Node.js v12.22.1 Meteor METEOR@2.1.1 port=20741 environment=development nobatch=no logLevel=5

I believe the cause is this

'use strict';

var NodeHTTPParser = process.binding('http_parser').HTTPParser,
    version        = NodeHTTPParser.RESPONSE ? 6 : 4;

which I find in

.meteor/packages/ddp-server/.2.3.2.1jl3owp.wpsuf++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/websocket-driver/lib/websocket/

The http_parser that line uses is deprecated and node spews the warning.

I think that previous posters are implying there is a branch of meteor which uses the jkuester approach to the http package but merely adding jkuester:http does not fix it for me.

2 Likes

Clearly, Meteor should simply implement the jkeuster approach, in hindsight this seems obvious.

To those looking to remove the deprecation warning while waiting for an updated meteor build that solves this, here are the complete steps that I did

  1. Checkout jkuester:http package to another folder outside my project. GitHub - jankapunkt/meteor-http: Make HTTP calls to remote servers using fetch API. Fork of the core http package.
  2. Copy or symlink the folder to /packages/http
  3. Open the file /packages/http/package.js and update the name of the package from jkuester:http to http

@jkuester created a new branch so that you can skip item no. 3 above. Here is the new branch: GitHub - jankapunkt/meteor-http at core-replacement

1 Like

Tried many iterations of these steps and none worked for me to remove the error. I believe @bogometer found the real cause

You guys might be experiencing a different warning than we did. It will need a different fix from the core. You might want to open an issue in github

Done. [2.1.1] (node:11737) [DEP0131] DeprecationWarning: The legacy HTTP parser is deprecated. · Issue #11388 · meteor/meteor (github.com)

1 Like