#3748·request

Unhandled error when attempting to convert a very long string to a different format

Author: tony-0tisCreated Jun 16, 2025Updated Jun 16, 2025
Error: Cannot create a string longer than 0x1fffffe8 characters
    at Buffer.toString (node:buffer:858:17)
    at Request.<anonymous> (/www/node_modules/request/request.js:1128:39)
    at Request.emit (node:events:536:35)
    at IncomingMessage.<anonymous> (/www/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (node:events:638:28)
    at IncomingMessage.emit (node:events:536:35)
    at endReadableNT (node:internal/streams/readable:1698:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)

Link to the location in the code that does not handle this error


Solution: Do not pass the callback when calling request in any way( request({uri: “”}, callback) || request({uri: “”, callback}) ) but subscribe to the complete event.

request({uri: “”}).on('complete, response=>{})