fix(api): disable default body parser on OpenAPI catch-all route#4770
Open
mutawakkilalallah wants to merge 1 commit into
Open
fix(api): disable default body parser on OpenAPI catch-all route#4770mutawakkilalallah wants to merge 1 commit into
mutawakkilalallah wants to merge 1 commit into
Conversation
The OpenAPI catch-all handler at pages/api/[...trpc].ts was missing the Next.js API route config to disable the built-in body parser. Without bodyParser: false, Next.js applies its default JSON body parser with a 1MB size limit, rejecting multipart file uploads (e.g. drop deployment zips) before they reach tRPC's content-type handler. The tRPC-specific route at pages/api/trpc/[trpc].ts already had this config, so uploads through the frontend UI worked correctly. Only direct API calls via the OpenAPI route were affected. Fixes Dokploy#4236
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Drop deployment uploads via the OpenAPI route (
POST /api/drop-deployment) fail with HTTP 413 for zip files larger than ~1MB. This affects direct API consumers (curl, external tools, custom panels) but not the Dokploy frontend UI.Fixes #4236
Root Cause
The OpenAPI catch-all handler at
pages/api/[...trpc].tswas missing the Next.js API route config to disable the built-in body parser. WithoutbodyParser: false, Next.js applies its default JSON body parser with a 1MB size limit, which rejects multipart file uploads before they reach tRPC's content-type handler.The tRPC-specific route at
pages/api/trpc/[trpc].tsalready had this config (lines 19-24), so uploads through the frontend UI worked correctly. Only the OpenAPI catch-all route was affected.Fix
Added
export const config = { api: { bodyParser: false } }topages/api/[...trpc].ts, matching the existing config in the tRPC route handler.Files Changed
apps/dokploy/pages/api/[...trpc].ts— added body parser config (6 lines added)Manual Test Steps
sourceType: drop