Skip to content

Commit f0fc865

Browse files
authored
fix(orchestrator): makes the bodyParser limit configurable. (#2802) (#2858)
* 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 length larger fixes: https://redhat.atlassian.net/browse/RHDHSUPP-362 * squash: add the contentLengthLimit to the common config * squash: only add to the global * squash: add comment
1 parent e51b966 commit f0fc865

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
@@ -147,6 +147,8 @@ catalog:
147147
dynamicPlugins:
148148
frontend: {}
149149
orchestrator:
150+
# Uncomment to set the content length limit for the requests. Defaults to 102400 bytes (100kb)
151+
# contentLengthLimit: 10mb
150152
# Uncomment and configure to use the log viewer
151153
# workflowLogProvider:
152154
# loki:

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

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