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.

OutgoingMessage.prototype._headerNames is deprecated

See original GitHub issue

Greetings 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:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
paulmelnikowcommented, Aug 13, 2019

Since we’ve published it to next, I you should also be able to use 11.0.0.

0reactions
mastermattcommented, Aug 12, 2019

@bnb can you verify it works for you when using the latest beta release?

Read more comments on GitHub >

github_iconTop 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 >

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