Node.js NodeJS:“;错误:标题检查不正确";在AWS Lambda上,但不是本地

Node.js NodeJS:“;错误:标题检查不正确";在AWS Lambda上,但不是本地,node.js,aws-lambda,request,gunzip,Node.js,Aws Lambda,Request,Gunzip,我有一个AWS Lambda函数,用于从特定url下载带有“request”的.gz文件,并将流传输到zlib.createGunzip()。虽然它在本地工作,但在Lambda上存在错误 Error: incorrect header check at Zlib.zlibOnError [as onerror] (zlib.js:180:17) { errno: -3, code: 'Z_DATA_ERROR' } Local response.headers: { ser

我有一个AWS Lambda函数,用于从特定url下载带有“request”的.gz文件,并将流传输到zlib.createGunzip()。虽然它在本地工作,但在Lambda上存在错误

Error: incorrect header check
    at Zlib.zlibOnError [as onerror] (zlib.js:180:17) {
  errno: -3,
  code: 'Z_DATA_ERROR'
}
Local response.headers:

{
  server: 'nginx/1.12.2',
  date: 'Thu, 19 Nov 2020 19:57:16 GMT',
  'content-type': 'text/html; charset=utf-8',
  'content-length': '788',
  connection: 'close',
  expires: 'Thu, 19 Nov 1981 08:52:00 GMT',
  'cache-control': 'no-store, no-cache, must-revalidate',
  pragma: 'no-cache',
  'content-disposition': 'attachment; filename="2020-11-18.csv.gz"'
}
{
  server: 'nginx/1.12.2',
  date: 'Thu, 19 Nov 2020 19:59:05 GMT',
  'content-type': 'text/html; charset=UTF-8',
  'transfer-encoding': 'chunked',
  connection: 'close',
  expires: 'Thu, 19 Nov 1981 08:52:00 GMT',
  'cache-control': 'no-store, no-cache, must-revalidate',
  pragma: 'no-cache'
}
Lambda response.headers:

{
  server: 'nginx/1.12.2',
  date: 'Thu, 19 Nov 2020 19:57:16 GMT',
  'content-type': 'text/html; charset=utf-8',
  'content-length': '788',
  connection: 'close',
  expires: 'Thu, 19 Nov 1981 08:52:00 GMT',
  'cache-control': 'no-store, no-cache, must-revalidate',
  pragma: 'no-cache',
  'content-disposition': 'attachment; filename="2020-11-18.csv.gz"'
}
{
  server: 'nginx/1.12.2',
  date: 'Thu, 19 Nov 2020 19:59:05 GMT',
  'content-type': 'text/html; charset=UTF-8',
  'transfer-encoding': 'chunked',
  connection: 'close',
  expires: 'Thu, 19 Nov 1981 08:52:00 GMT',
  'cache-control': 'no-store, no-cache, must-revalidate',
  pragma: 'no-cache'
}
因此,我将两个流都写入一个文件,而不是gunzip。在当地看起来是这样的:

\u0000\u0000\u0000\u0000\u0000�U]oI|�WDynV�_�=�"�B(!w���X�pdo����Z{��]픫��j���
K�܀��L��ǫ�]�38�A��{���������!/���%J/_��l�7��zX����|x��O?_p������E@�E�0~]N"�
                              &%...
关于Lambda:

��U]oI|�WDynV�_�=�"�B(!w���X�pdo��﯇��Z{��]픫��j�����{�������弿~��0X�������j�C�u9̾�y?[ϯ�
�,�~q������Y�y�vn��Yί���f�ޮW�M<���%J/_��l�7��zX����|x��O?_p������E@L�E�0~]N"�
K�܀��L��ǫ�]�38�A��{���������!/&%...
我修改了请求“gzip:true”或“encoding:null”。同时使用“fs.createReadStream(
/tmp/file.csv.gz
,'utf8')”。一切都没有成功

有什么想法吗