Skip to content

Commit

Permalink
increase limit of uploaded build files (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
yehiyam authored Jun 10, 2021
1 parent aa18dd8 commit b3f7e20
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 7 additions & 4 deletions commands/store/algorithms/applyImpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const merge = require('lodash.merge');
const FormData = require('form-data');
const ora = require('ora');
const expandTilde = require('expand-tilde');
const formatSize = require('pretty-bytes');

const { postFile, getUntil, post, get } = require('../../../helpers/request-helper');
const { zipDirectory } = require('../../../helpers/zipper');
Expand Down Expand Up @@ -158,8 +159,9 @@ const handleApply = async ({ endpoint, rejectUnauthorized, name, file, noWait, s
let error;
const spinner = ora({ text: 'Build starting', spinner: 'line' }).start();
try {
let stream; let
fileData;
let stream;
let fileData;
let stats;
if (file) {
const fileContent = readFile(file);
if (fileContent.error) {
Expand Down Expand Up @@ -196,15 +198,16 @@ const handleApply = async ({ endpoint, rejectUnauthorized, name, file, noWait, s
expandedPath
);
}
const stats = await fse.stat(codePath);
stats = await fse.stat(codePath);
if (stats.isDirectory()) {
// create zip file
const zipFileName = await zipDirectory(codePath, { tmpFile: true, spinner });
codePath = zipFileName;
stats = await fse.stat(codePath);
}
stream = fse.createReadStream(codePath);
}
spinner.text = 'Uploading algorithm data';
spinner.text = `Uploading algorithm data (size is ${stats && formatSize(stats.size)})`;
const formData = new FormData();
formData.append('payload', JSON.stringify(body));
formData.append('file', stream || '');
Expand Down
4 changes: 3 additions & 1 deletion helpers/request-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const _request = async ({ endpoint, rejectUnauthorized, path, method, body, form
json: true,
data: body || formData,
headers: formData ? formData.getHeaders() : {},
timeout
timeout,
maxBodyLength: 1e15,
maxContentLength: 1e15
});
}
catch (e) {
Expand Down

0 comments on commit b3f7e20

Please sign in to comment.