express-bunyan-logger icon indicating copy to clipboard operation
express-bunyan-logger copied to clipboard

Eliminate Node12 header deprecation warning (DEP0066)

Open twhitner-vistaprint opened this issue 4 years ago • 3 comments

https://nodejs.org/api/deprecations.html#deprecations_dep0066_outgoingmessage_prototype_headers_outgoingmessage_prototype_headernames

twhitner-vistaprint avatar Oct 04 '19 12:10 twhitner-vistaprint

Do you mind use the solution here so that it doesn't need an extra dependency?

https://github.com/newrelic/node-newrelic/blob/0113eb5f0e707dc662a17d262a841503bab88841/lib/instrumentation/core/http.js#L214

  'res-headers': (res.getHeaders && res.getHeaders()) || res._headers,

zorji avatar Oct 15 '20 11:10 zorji

We are also looking forward to this fix, @twhitner-vistaprint are you free to update the pr to use the simplified logic @zorji suggested?

(node:45346) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
...
(node:45363) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
    at ServerResponse.logging (~/myapp/node_modules/express-bunyan-logger/index.js:130:36)
    at ServerResponse.emit (events.js:327:22)
    at ServerResponse.EventEmitter.emit (domain.js:486:12)
    at onFinish (_http_outgoing.js:766:10)
    at callback (_stream_writable.js:513:21)
    at afterWrite (_stream_writable.js:466:5)
    at afterWriteTick (_stream_writable.js:453:10)
    at processTicksAndRejections (internal/process/task_queues.js:79:21)

``

cesine avatar Dec 08 '20 20:12 cesine

I have merged the fix in my own updated fork at: https://www.npmjs.com/package/@chaudhryjunaid/express-bunyan-logger

chaudhryjunaid avatar Jun 15 '21 05:06 chaudhryjunaid