balderdashy / sails

Realtime MVC Framework for Node.js
https://sailsjs.com
MIT License
22.84k stars 1.95k forks source link

Node 12 Error: DeprecationWarning: OutgoingMessage.prototype._headers is deprecated #6916

Open mythofleader opened 4 years ago

mythofleader commented 4 years ago

Node version: 12.13 Sails version (sails): 1.2.3 ORM hook version (sails-hook-orm): Sockets hook version (sails-hook-sockets): Organics hook version (sails-hook-organics): Grunt hook version (sails-hook-grunt): Uploads hook version (sails-hook-uploads): DB adapter & version (e.g. sails-mysql@5.55.5): Skipper adapter & version (e.g. skipper-s3@5.55.5):


The error message shows up when server running on Node.js version >= 12.x.x.

This link says that _headers should be used getHeaders, setHeader instead.

sailsbot commented 4 years ago

@mythofleader Thanks for posting! We'll take a look as soon as possible.

In the mean time, there are a few ways you can help speed things along:

Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.

For help with questions about Sails, click here.

johnabrams7 commented 4 years ago

@mythofleader When / where are you seeing this error? Would you be willing to provide us a repo that reproduces this (we can run it with node 12.x.x)?

mythofleader commented 4 years ago

@johnabrams7 I found that error while I was testing this serverless-http project.

The way to check the error is

  1. use node.js version v12.13.0
  2. install serverless-http and test the sails.js file in test folder

There are some files using res._headers.

  1. serverless-http: lib/response.js
  2. sails: lib/router/res.js

I sent a pull request to serverless-http about this error few days ago.

oNddleo commented 4 years ago

@mythofleader you can change res._header to res.getHeaders in lib to fix it