node-js-libs / curlrequest

A cURL wrapper
MIT License
184 stars 44 forks source link

Error when sending lots of data in body #64

Open leondroidgeeks opened 7 years ago

leondroidgeeks commented 7 years ago

When I make a post request which contains a large body I get this error:

internal/child_process.js:319
    throw errnoException(err, 'spawn');
    ^

Error: spawn E2BIG
    at exports._errnoException (util.js:1050:11)
    at ChildProcess.spawn (internal/child_process.js:319:11)
    at Object.exports.spawn (child_process.js:378:9)
    at module.exports (/Users/Leon/Desktop/demo-repository/node_modules/curlrequest/spawn.js:19:30)
    at Object.exports.request (/Users/Leon/Desktop/demo-repository/node_modules/curlrequest/index.js:248:17)
    at Object.<anonymous> (/Users/Leon/Desktop/demo-repository/test.js:40:10)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)

When I try to send a smaller file (smaller body) it works. When I send the request using Postman I works as well even with the large file.

asankagit commented 6 years ago

Its looks like same issue ....error occurs when uploading files more than 100kB

let options = {
        url: full_url,
        method: http_method,
        data: payload

    };  

postData as payload

let postData = {
      name: imageData.name,
      bytes: new Buffer(fileData).toString('base64').toString('utf8')

    };
Unhandled rejection Error: spawn E2BIG
    at _errnoException (util.js:1031:13)
    at ChildProcess.spawn (internal/child_process.js:340:11)
    at Object.exports.spawn (child_process.js:499:9)
    ....