Merge pull request #27823 from overleaf/em-increase-max-request-size

Increase max request size in docstore and history

GitOrigin-RevId: 8ce6c023027457a65431ee5deb2f75f467914f14
This commit is contained in:
Eric Mc Sween
2025-08-18 07:34:11 -04:00
committed by Copybot
parent a05ade0f84
commit 89687b5e66
4 changed files with 9 additions and 8 deletions

View File

@@ -41,7 +41,7 @@ const Settings = {
max_doc_length: parseInt(process.env.MAX_DOC_LENGTH) || 2 * 1024 * 1024, // 2mb
maxJsonRequestSize:
parseInt(process.env.MAX_JSON_REQUEST_SIZE) || 6 * 1024 * 1024, // 6 MB
parseInt(process.env.MAX_JSON_REQUEST_SIZE) || 12 * 1024 * 1024, // 6 MB
unArchiveBatchSize: parseInt(process.env.UN_ARCHIVE_BATCH_SIZE, 10) || 50,
parallelArchiveJobs: parseInt(process.env.PARALLEL_ARCHIVE_JOBS, 10) || 5,

View File

@@ -521,11 +521,9 @@ describe('Applying updates to a doc', function () {
return describe('when the json payload is too large', function () {
beforeEach(function (done) {
const line = new Array(1025).join('x') // 1kb
this.largeLines = Array.apply(null, Array(1024)).map(() => line) // 1kb
this.originalRanges.padding = Array.apply(null, Array(6144)).map(
() => line
) // 6mb
const line = new Array(1024).join('x') // 1 KB
this.largeLines = new Array(8192).fill(line) // 8 MB
this.originalRanges.padding = new Array(6144).fill(line) // 6 MB
return DocstoreClient.updateDoc(
this.project_id,
this.doc_id,

View File

@@ -34,7 +34,7 @@ Metrics.leaked_sockets.monitor(logger)
// We may have fairly large JSON bodies when receiving large Changes. Clients
// may have to handle 413 status codes and try creating files instead of sending
// text content in changes.
app.use(bodyParser.json({ limit: '6MB' }))
app.use(bodyParser.json({ limit: '12MB' }))
app.use(
bodyParser.urlencoded({
extended: false,

View File

@@ -119,7 +119,10 @@ async function persistChanges(projectId, allChanges, limits, clientEndVersion) {
const change = changes[0]
const changeBytes = countChangeBytes(change)
if (totalBytes + changeBytes > limits.maxChunkChangeBytes) {
if (
chunk.getChanges().length > 0 &&
totalBytes + changeBytes > limits.maxChunkChangeBytes
) {
break
}