diff --git a/services/document-updater/app.js b/services/document-updater/app.js index 7555ad666b..e23fa3ca7b 100644 --- a/services/document-updater/app.js +++ b/services/document-updater/app.js @@ -31,7 +31,7 @@ Metrics.event_loop.monitor(logger, 100) const app = express() app.use(Metrics.http.monitor(logger)) -app.use(bodyParser.json({ limit: Settings.max_doc_length + 64 * 1024 })) +app.use(bodyParser.json({ limit: Settings.maxJsonRequestSize })) Metrics.injectMetricsRoute(app) DispatchManager.createAndStartDispatchers(Settings.dispatcherCount || 10) diff --git a/services/document-updater/config/settings.defaults.js b/services/document-updater/config/settings.defaults.js index ff5a35a515..21c3219a33 100755 --- a/services/document-updater/config/settings.defaults.js +++ b/services/document-updater/config/settings.defaults.js @@ -168,6 +168,8 @@ module.exports = { }, max_doc_length: 2 * 1024 * 1024, // 2mb + maxJsonRequestSize: + parseInt(process.env.MAX_JSON_REQUEST_SIZE, 10) || 8 * 1024 * 1024, dispatcherCount: process.env.DISPATCHER_COUNT, diff --git a/services/document-updater/test/acceptance/js/SettingADocumentTests.js b/services/document-updater/test/acceptance/js/SettingADocumentTests.js index 6c13282ba5..2107f46e92 100644 --- a/services/document-updater/test/acceptance/js/SettingADocumentTests.js +++ b/services/document-updater/test/acceptance/js/SettingADocumentTests.js @@ -230,8 +230,7 @@ describe('Setting a document', function () { }) this.newLines = [] while ( - JSON.stringify(this.newLines).length < - Settings.max_doc_length + 64 * 1024 + JSON.stringify(this.newLines).length <= Settings.maxJsonRequestSize ) { this.newLines.push('(a long line of text)'.repeat(10000)) }