Skip to content

Commit d85bf56

Browse files
authored
fix(orchestrator): makes the bodyParser limit configurable. (#2802)
* fix(orchestrator): makes the bodyParser limit configurable. A customer was having an issue where the workflows content length was over the 100kb limit. This adds a configurable value to make the content lenght larger fixes: https://redhat.atlassian.net/browse/RHDHSUPP-351 * squash: add changeset * squash: add changeset * squash: add the contentLengthLimit to the common config * squash: only add to the global * squash: add comment
1 parent cc98168 commit d85bf56

5 files changed

Lines changed: 29 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-orchestrator-backend': patch
3+
---
4+
5+
fix: add configurable bodyParser limit
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-orchestrator-common': patch
3+
---
4+
5+
chore: add new config value for contentLengthLimit

workspaces/orchestrator/app-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ catalog:
158158
dynamicPlugins:
159159
frontend: {}
160160
orchestrator:
161+
# Uncomment to set the content length limit for the requests. Defaults to 102400 bytes (100kb)
162+
# contentLengthLimit: 10mb
161163
# Uncomment and configure to use the log viewer
162164
# workflowLogProvider:
163165
# loki:

workspaces/orchestrator/plugins/orchestrator-backend/src/service/router.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,18 @@ export async function createBackendRouter(
202202
const permissionsIntegrationRouter = createPermissionIntegrationRouter({
203203
permissions: orchestratorPermissions,
204204
});
205-
router.use(express.json());
205+
const contentLengthLimit = config.getOptionalString(
206+
'orchestrator.contentLengthLimit',
207+
);
208+
/**
209+
* Set the content length limit for the requests.
210+
* Defaults to 102400 bytes (100kb)
211+
*
212+
* There is a possiblity that some workflows will have a very large payload, which could cause a 413 error.
213+
* Increasing this value will allow larger payloads to be processed.
214+
*
215+
*/
216+
router.use(express.json({ limit: contentLengthLimit }));
206217
router.use(permissionsIntegrationRouter);
207218
router.use('/workflows', express.text());
208219
router.get('/health', (_, response) => {

workspaces/orchestrator/plugins/orchestrator-common/config.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export interface Config {
1919
* Configuration for the Orchestrator plugin.
2020
*/
2121
orchestrator?: {
22+
/**
23+
* Set the content length limit for the requests.
24+
* Defaults to 102400 bytes (100kb)
25+
*/
26+
contentLengthLimit?: string;
2227
sonataFlowService: {
2328
/**
2429
* Base URL of the Sonata Flow service.

0 commit comments

Comments
 (0)