Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Agent Instructions

## Versioning

Don't change the `version` in `package.json` in a PR that makes other changes. Version bumps go in their own separate PR.
1 change: 1 addition & 0 deletions CLAUDE.md
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"adm-zip": "^0.5.2",
"axios": "1.15.0",
"axios": "1.20.0",
"chalk": "^4.1.0",
"form-data": "^3.0.0",
"glob": "^7.1.6",
Expand Down
4 changes: 4 additions & 0 deletions src/sourcemaps/signed-url-uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ class SignedUrlUploader {
headers: {
'Content-Type': 'application/octet-stream',
},
// maxBodyLength: don't cap the upload size client side; the signed URL
// decides what it accepts. maxContentLength (response size) matches RollbarAPI.
maxContentLength: Infinity,
maxBodyLength: Infinity,
});
if (resp.status === 200) {
output.status('Success', 'Uploaded zip file successfully');
Expand Down
33 changes: 31 additions & 2 deletions test/sourcemaps/signed-url-uploader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const expect = require('chai').expect;
const sinon = require('sinon');
const axios = require('axios')
const http = require('http');

const SignedUrlUploader = require('../../src/sourcemaps/signed-url-uploader');
const Scanner = require('../../src/sourcemaps/scanner');
Expand Down Expand Up @@ -68,7 +69,35 @@ describe('.upload()', function() {
statusText: 'Success',
});

await signedUrlUploader.upload(false, files);
expect(stub.callCount).to.equal(1);
try {
await signedUrlUploader.upload(false, files);
expect(stub.callCount).to.equal(1);
} finally {
stub.restore();
}
});

it('should upload zips larger than 10 MB', async function() {
let received = 0;
const server = http.createServer((req, res) => {
req.on('data', (chunk) => { received += chunk.length; });
req.on('end', () => { res.writeHead(200); res.end(); });
});
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));

const size = 11 * 1024 * 1024;
const signedUrlUploader = new SignedUrlUploader();
signedUrlUploader.zipFiles = function() { this.zipBuffer = Buffer.alloc(size); };
const spy = sinon.spy(axios, 'put');

try {
await signedUrlUploader.upload(false, [], `http://127.0.0.1:${server.address().port}/`);
} finally {
spy.restore();
server.close();
}

expect(spy.firstCall.args[2].maxBodyLength).to.equal(Infinity);
expect(received).to.equal(size);
});
});
Loading