1

I am getting this error while trying to hit the POST and PUT APIs using GOT package in Node.Js (for external API calling).

I am using Got@11.8.6 with Node.js version 16.18.1 in Windows 10 OS.

Code Snippet

const gotObject = { method: 'POST', json: true, body: reqBodyObj, headers: reqHeader, };
const apiResponse = await got(microserviceUrl, gotObject);

Error Stack

2022-12-19T11:38:44.708Z - error: [D:\Projects\NodeJs\gateway\src\services\microservice.ts] callService  at Request._destroy (D:\Projects\NodeJs\node-api-gateway\node_modules\got\dist\source\core\index.js:1386:21) at _destroy (node:internal/streams/destroy:102:25) at Request.destroy (node:internal/streams/destroy:64:5) at D:\Projects\NodeJs\node-api-gateway\node_modules\got\dist\source\core\index.js:354:26 at processTicksAndRejections (node:internal/process/task_queues:96:5) at Request._finalizeBody (D:\Projects\NodeJs\node-api-gateway\node_modules\got\dist\source\core\index.js:726:23)        at D:\Projects\NodeJs\node-api-gateway\node_modules\got\dist\source\core\index.js:333:28 at new Request (D:\Projects\NodeJs\node-api-gateway\node_modules\got\dist\source\core\index.js:357:11) at makeRequest (D:\Projects\NodeJs\node-api-gateway\node_modules\got\dist\source\as-promise\index.js:35:29)
VLAZ
  • 26,331
  • 9
  • 49
  • 67
Ketav
  • 760
  • 1
  • 8
  • 27

0 Answers0