question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attempts to download a >1GB files fail

See original GitHub issue

Steps to reproduce

  • Attempt to download a large ~1GB file using the dropbox.filesDownload() method

Expected Result

  • File gets downloaded fine.

Actual Result

  • A V8 memory error is logged and the download fails:

Logs

/node_modules/dropbox/src/download-request.js:27
  res.on('data', function (chunk) { res.text += chunk; });
                          ^
RangeError: Invalid string length
    at IncomingMessage.<anonymous>  node_modules/dropbox/src/download-request.js:27:27)
    at emitOne (events.js:96:13)
    at IncomingMessage.emit (events.js:189:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at IncomingMessage.Readable.push (_stream_readable.js:134:10)
    at HTTPParser.parserOnBody (_http_common.js:123:22)
    at TLSSocket.socketOnData (_http_client.js:411:20)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:189:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at TLSSocket.Readable.push (_stream_readable.js:134:10)
    at TLSWrap.onread (net.js:551:20)

Notes

AFAIK RangeError: Invalid string length is a V8 out-of-memory error. It basically complaints that a string’s length is too long. Perhaps res.on('data') response should accumulate on a Buffer instead to circumvent this?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
sidhukocommented, Jun 15, 2017

@pran1990 duplicate of #101 and the PR #137 could update download-request.js and upload-request.js to return the Response object rather than buffered body. The Response object returns the stream (node-fetch) and has standardised methods to return different types of data, i.e. res.blob(), res.arrayBuffer() and res.json(). It also has properties for determining the response type (res.ok) and limiting duplicate consumption of the same stream (res.bodyUsed). Current methods in your SDK are very opposed to your company’s primary focus was on syncing large files between different operating systems…

Please read: https://developer.mozilla.org/en-US/docs/Web/API/Response

1reaction
BobDickinsoncommented, Aug 23, 2017

I’m not sure I agree that this is a dupe of #101 (though certainly a streams-based solution should handle upload and download). I don’t have a problem with lack of stream support on upload, since I’m doing multipart upload on anything over 8Mb, and that doesn’t cause any heartburn. But not being able to download large files (due to lack of stream support) is kind of a deal killer. I also don’t see any support for doing a range request to get around this. It seems like the ability to download large files is pretty key and that not having that should be a pretty high priority fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't download a certain large file - error: Failed - Network Error
Try a dedicated file downloader that can segment the download. Browsers are not good with large files & every browser you've tried so...
Read more >
6 Ways to Fix the “Download Failed Network Error” on Chrome
6 Ways to Fix the “Download Failed Network Error” on Chrome · 1. Check Your Internet Speed and Connection · 2. Modify Your...
Read more >
Downloads fail for files more than 1Gb if download speed is ...
The files fail to download if end-users have download speed lower than 8 MB/sec which is 64 Mbps. End users with 64 Mbps...
Read more >
Fix file download errors - Google Chrome Help
This error means that there's not enough space on your computer to download the file. To fix the error: Delete some files from...
Read more >
Large zip file downloads fail or need several attempts to ...
Hi Folks, Since we started allowing users to upload images at 1600x1200px we are having repeated download failures. Needless to say our zip...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found