question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The _stream_wrap module is deprecated

See original GitHub issue

On node 12.13.0 I see this warning:

(node:3822) [DEP0125] DeprecationWarning: The _stream_wrap module is deprecated.

It can be a low priority, of course, but it’s nice to keep track of it.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
pimterrycommented, Dec 23, 2021

Now fixed in Mockttp v2.5.0. The patch above is used to avoid the deprecation warning for all Node releases > v12. For v12 and older _stream_wrap is still required (the fix described here doesn’t work) but v12 is EOL in April so I’m fine with that.

I’ve also opened a PR to fix the underlying issue in Node itself in https://github.com/nodejs/node/pull/41185. That’s approved by a few Node maintainers now, but not yet merged. Hopefully that’ll make it in for Node v18 and potentially get backported as well, which will allow us to remove the patch here entirely, and should help a fair few other HTTP/2 use cases too.

1reaction
pimterrycommented, Aug 17, 2020

Yes, good to keep track of this.

Some context: this is used in https://github.com/httptoolkit/httpolyglot to ensure we can work around certain node issues. _stream_wrap exposes a wrapper class, that wraps a stream so you can use it as a net.Socket directly. E.g. so you can create a TLS connection on top of any duplex stream. When we set up connections, if they’re backed by such a wrapper rather than a raw net socket, then the servers avoid making certain (incorrect) assumptions about the raw socket buffers under the hood. We add wrappers for some HTTP/2 cases, to fix some assumptions made there.

I’ve been talking to the node team about this already, there’s further context in https://github.com/nodejs/node/issues/34296 if you’re interested. The conclusion is that we shouldn’t actually need _stream_wrap here, because every use case should actually be supported and working, so these are fundamentally just workarounds for node bugs, but right now those node bugs still exist, so it’s unfortunately hard to remove in the short term. That’s true for every currently supported node release, AFAIK, but hopefully there’ll be progress there soon! Once those issues disappear, we can remove this (at least, when using new node releases).

If the deprecation is a big problem in the meantime, we could do an inline require instead in httppolyglot, so that it only appears when the first HTTP/2 request appears. I’m inclined not to by default though, just to keep things simple, unless it does start to cause problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Difference Between Node.js 10 LTS and Node.js 12 LTS
The http , https , and tls modules now use the WHATWG URL parser by default. #20270. General. Use of process.binding() has been...
Read more >
Downloading images with node.js [closed] - Stack Overflow
I'd suggest using the request module. Downloading a file is as simple as the following code: var fs = require('fs'), request = require('request');...
Read more >
Node.js ChangeLog - Google Git
(Breaking) Deprecated the _linklist module (Rich Trott) #3078. ... [ 1738c77835 ] - (SEMVER-MINOR) streams: introduce StreamWrap and JSStream (Fedor ...
Read more >
Node.js v16.7.0 documentation - Thomas Hunter II
The assert module provides a set of assertion functions for verifying invariants. ... Stability: 0 - Deprecated: Use assert.fail([message]) or other assert ...
Read more >
https://raw.githubusercontent.com/nodejs/node/v4.2...
listenerCount(emitter, event)`, which has now been marked as deprecated in the ... module has been deprecated in anticipation of it becoming unsupportable ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found