0

I am running node server on ubuntu. i am using dropbox module in nodejs.(https://www.npmjs.com/package/dropbox)

node -v = v0.10.38

npm -v = 1.4.28

I am using angularjs in front-end to upload file using (https://github.com/danialfarid/ng-file-upload) library. Uploading small files < 25mb works fine. It is uploading to the server and uploading to dropbox. But when file if larger like (50mb). It is giving error.

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

RangeError: Maximum call stack size exceeded.

Here are relevant codes which i am using :

var client = new Dropbox.Client({
    "key": "XXXXXXXXXXX",
    "secret": "XXXXXXXXXXXX",
    "token": "XXXXXXXXXXXXXXXXXXx",
    "uid": "XXXX"
});
    app.all('/test', function (req, res) {
        console.log(req.files); 
        var f = req.files.file;
        var dbx_file_stat;
        var short_url;
        var new_file_name = 'generate file name';
        fs.readFile(f.path, function (error, data) {
            if (error) {
                console.log('read error');
                return console.log(error);
            }
            client.writeFile(new_file_name, data, function (error, stat) {
                if (error) {
                    console.log('write error');
                    return console.log(error);
                }
                //stopReportingProgress();
                client.makeUrl(new_file_name, {downloadHack:true},function (error,url) {
                        if (error) {
                        return console.log(error);
                    }                                       
                    res.send("it works");                             
                });
            });
        });
    })

The Large files are uploading to the server but unable to upload on dropbox server. I did some research . Some suggested to use (https://nodejs.org/api/timers.html#timers_setimmediate_callback_arg). But how to implement. what is causing this problem? I also tried running app through node --stack-size=320000 app.js New error came after this ,

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
Segmentation fault
4

1 回答 1

0

我无法使用以下代码和 75MB 文件重现您的错误。也许这个问题与您的应用程序的其他部分有关。(看起来您可能正在使用 Express?)

var fs = require('fs'),
    dropbox = require('dropbox');

var client = new dropbox.Client({ token: "REDACTED" });

fs.readFile('testfile', function (error, data) {
    client.writeFile('testfile', data, function (error, stat) {
        if (error) {
            console.log('ERROR: ' + error);
        } else {
            console.log(stat);
        }
    });
});

如果您仍然能够重现该错误,请分享一个较小的重现。

于 2015-05-27T22:49:22.847 回答