OutgoingMessage.prototype._headerNames is deprecated
See original GitHub issueGreetings folks!
We are running into an error with our tests while using nock:
Node.js version: v12.7.0
Test framework: mocha
Nock version: 10.0.0
--throw-deprecation
enabled on tests
When we use this call:
nock(HOST_ADDRESS)
.get(path, undefined, {reqheaders: HEADERS})
.reply(statusCode, {access_token: 'abc123', expires_in: 10000}, HEADERS);
We are getting a stack trace like this:
DeprecationWarning: Could not refresh access token: OutgoingMessage.prototype._headerNames is deprecated
at setHeader (node_modules/nock/lib/request_overrider.js:34:24)
at /Users/beckwith/Code/google-auth-library-nodejs/node_modules/nock/lib/request_overrider.js:108:7
at /Users/beckwith/Code/google-auth-library-nodejs/node_modules/lodash/lodash.js:4905:15
at baseForOwn (node_modules/lodash/lodash.js:2990:24)
at Function.forOwn (node_modules/lodash/lodash.js:13014:24)
at RequestOverrider (node_modules/nock/lib/request_overrider.js:107:7)
at new OverriddenClientRequest (node_modules/nock/lib/intercept.js:260:23)
at /Users/beckwith/Code/google-auth-library-nodejs/node_modules/nock/lib/intercept.js:395:13
at module.request (node_modules/nock/lib/common.js:140:14)
at /Users/beckwith/Code/google-auth-library-nodejs/node_modules/node-fetch/lib/index.js:1432:15
at new Promise (<anonymous>)
at fetch (node_modules/node-fetch/lib/index.js:1401:9)
at Gaxios.request (node_modules/gaxios/src/gaxios.ts:81:27)
at Gaxios.request (node_modules/gaxios/src/gaxios.ts:99:21)
at metadataAccessor (node_modules/gcp-metadata/src/index.ts:62:17)
at Compute.refreshTokenNoCache (src/auth/computeclient.ts:54:79)
at Compute.getRequestMetadataAsync (src/auth/oauth2client.ts:405:4)
at Compute.requestAsync (build/src/auth/oauth2client.js:52:1990)
at Context.<anonymous> (test/test.compute.ts:65:3)
After testing … it does look like this is resolved in 11.0.0-beta.30
😃
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
How to fix (node:12388) [DEP0066] DeprecationWarning ...
When I started project I got warning from node ([DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated) every time.
Read more >HTTP | Node.js v19.3.0 Documentation
Stability: 0 - Deprecated. Listen for the 'close' event instead. Emitted when the request has been aborted by the client. This event is...
Read more >OutgoingMessage.prototype._headers is deprecated ...
Hi there, thank you guys for making balenaOS! I try to get a simple node.js with the gcloudsdk working but the image can't...
Read more >3x9pyx3us - NodeJS - OneCompiler
Server-side platform for building fast and scalable applications. Node.js is Asynchronous , event-driven and works on single-thread model thus eliminating the ...
Read more >Code coverage report for lib/_http_outgoing.js
_writeRaw(data, encoding, callback); }; OutgoingMessage.prototype. ... var headers = {}; var keys = Object.keys(headersMap); var headerNames = this.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Since we’ve published it to
next
, I you should also be able to use11.0.0
.@bnb can you verify it works for you when using the latest beta release?