From 009c80d4d5b01ccf2277244de2fde53744b80900 Mon Sep 17 00:00:00 2001 From: Lucas Holmquist Date: Fri, 17 Apr 2026 16:43:33 -0400 Subject: [PATCH] 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 --- .../orchestrator/.changeset/purple-eagles-share.md | 5 +++++ .../orchestrator/.changeset/strong-pillows-yawn.md | 5 +++++ workspaces/orchestrator/app-config.yaml | 2 ++ .../orchestrator-backend/src/service/router.ts | 13 ++++++++++++- .../plugins/orchestrator-common/config.d.ts | 5 +++++ 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 workspaces/orchestrator/.changeset/purple-eagles-share.md create mode 100644 workspaces/orchestrator/.changeset/strong-pillows-yawn.md diff --git a/workspaces/orchestrator/.changeset/purple-eagles-share.md b/workspaces/orchestrator/.changeset/purple-eagles-share.md new file mode 100644 index 00000000000..a9bf1fcfc05 --- /dev/null +++ b/workspaces/orchestrator/.changeset/purple-eagles-share.md @@ -0,0 +1,5 @@ +--- +'@red-hat-developer-hub/backstage-plugin-orchestrator-backend': patch +--- + +fix: add configurable bodyParser limit diff --git a/workspaces/orchestrator/.changeset/strong-pillows-yawn.md b/workspaces/orchestrator/.changeset/strong-pillows-yawn.md new file mode 100644 index 00000000000..11bba090fd8 --- /dev/null +++ b/workspaces/orchestrator/.changeset/strong-pillows-yawn.md @@ -0,0 +1,5 @@ +--- +'@red-hat-developer-hub/backstage-plugin-orchestrator-common': patch +--- + +chore: add new config value for contentLengthLimit diff --git a/workspaces/orchestrator/app-config.yaml b/workspaces/orchestrator/app-config.yaml index f48392273b2..d9ccf3f4867 100644 --- a/workspaces/orchestrator/app-config.yaml +++ b/workspaces/orchestrator/app-config.yaml @@ -147,6 +147,8 @@ catalog: dynamicPlugins: frontend: {} orchestrator: + # Uncomment to set the content length limit for the requests. Defaults to 102400 bytes (100kb) + # contentLengthLimit: 10mb # Uncomment and configure to use the log viewer # workflowLogProvider: # loki: diff --git a/workspaces/orchestrator/plugins/orchestrator-backend/src/service/router.ts b/workspaces/orchestrator/plugins/orchestrator-backend/src/service/router.ts index 4cd897b922a..c467d23702e 100644 --- a/workspaces/orchestrator/plugins/orchestrator-backend/src/service/router.ts +++ b/workspaces/orchestrator/plugins/orchestrator-backend/src/service/router.ts @@ -201,7 +201,18 @@ export async function createBackendRouter( const permissionsIntegrationRouter = createPermissionIntegrationRouter({ permissions: orchestratorPermissions, }); - router.use(express.json()); + const contentLengthLimit = config.getOptionalString( + 'orchestrator.contentLengthLimit', + ); + /** + * Set the content length limit for the requests. + * Defaults to 102400 bytes (100kb) + * + * There is a possiblity that some workflows will have a very large payload, which could cause a 413 error. + * Increasing this value will allow larger payloads to be processed. + * + */ + router.use(express.json({ limit: contentLengthLimit })); router.use(permissionsIntegrationRouter); router.use('/workflows', express.text()); router.get('/health', (_, response) => { diff --git a/workspaces/orchestrator/plugins/orchestrator-common/config.d.ts b/workspaces/orchestrator/plugins/orchestrator-common/config.d.ts index 762d49ec034..5f2523080f9 100644 --- a/workspaces/orchestrator/plugins/orchestrator-common/config.d.ts +++ b/workspaces/orchestrator/plugins/orchestrator-common/config.d.ts @@ -19,6 +19,11 @@ export interface Config { * Configuration for the Orchestrator plugin. */ orchestrator?: { + /** + * Set the content length limit for the requests. + * Defaults to 102400 bytes (100kb) + */ + contentLengthLimit?: string; sonataFlowService: { /** * Base URL of the Sonata Flow service.