4

Sometimes my get request to an api fails with this error message, (btw im using the request module to trigger my requests)

Error: toString failed
buffer.js:378
    throw new Error('toString failed');
    ^

Error: toString failed
    at Buffer.toString (buffer.js:378:11)
    at BufferList.toString (/home/vardha/www/abp/node_modules/bl/bl.js:155:33)
    at Request.<anonymous> (/home/vardha/www/abp/node_modules/request/request.js:1013:32)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/home/vardha/www/abp/node_modules/request/request.js:962:12)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:921:12)
    at nextTickCallbackWith2Args (node.js:442:9)

This has been buggin me a lot since I have no idea as to whats causing this and was not able to find any clear solution in the github page. ANy help would be appreciated.

1 Answer 1

8

This error usually occurs when you request for file which is relatively bigger in size (or) the bufferlength exceeds / reaches 256 MB which the V8 engine will throw as an error.

This issue is still being addressed by the NodeJS community Read out this comprehensive post which has all the progress/answers that you are looking for.

https://github.com/nodejs/node/pull/4394

Hope this helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.