REST API ignores JSON bodies sent with `Content-Type: application/json; charset=utf-8`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- json, next.js, typescript
Línea de trabajo
Start with the Node HTTP adapter in src/adapters/node-http/core.ts and src/adapters/node-http/input.ts, and run the provided curl reproduction against the API route in pages/api/[...trpc].ts. Add a regression test for Content-Type: application/json; charset=utf-8, ensuring the media type is compared separately from its parameters. Done means the body reaches input validation, the regression test passes, and Dokploy bumps @dokploy/trpc-openapi to the fixed fork release.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
A POST /api/<procedure> request with Content-Type: application/json; charset=utf-8 fails with
400 Input validation failed, and every body field is reported as undefined. The same request with
Content-Type: application/json works. charset is a valid media-type parameter (RFC 9110, section
8.3.1), and several HTTP clients add it by default. One example is .NET's JsonContent.
Versions
- Seen on a Dokploy v0.30.x instance. We do not know the exact patch version.
- From reading the code (not tested on each release), affected releases are v0.30.3 through v0.31.4
(the latest release, 2026-11-17) andcanary. #5048 setbodyParser: falseon the OpenAPI
catch-all route, and that change first shipped in v0.30.3. In v0.30.0 to v0.30.2, Next.js parsed the
body itself, and Next.js reads only the media type. @dokploy/trpc-openapi0.0.18, which every one of these releases pins. 0.0.19 and the fork'smain
(814c8b4) have the same code.
To reproduce
DOKPLOY=https://dokploy.example.com # placeholder
# A made-up id keeps this harmless: the only question is whether the body is read.
BODY='{"applicationId":"does-not-exist"}'
# 1) Plain media type: the body is parsed. The request gets past input validation
# and fails later, on the made-up id.
curl -sS -X POST "$DOKPLOY/api/application.stop" \
-H "x-api-key: $DOKPLOY_API_KEY" \
-H "Content-Type: application/json" \
--data "$BODY"
# 2) Same request with a charset parameter: the body is dropped.
curl -sS -X POST "$DOKPLOY/api/application.stop" \
-H "x-api-key: $DOKPLOY_API_KEY" \
-H "Content-Type: application/json; charset=utf-8" \
--data "$BODY"
Expected vs. actual
-
Expected: both requests behave the same, because the body is parsed as JSON in both cases.
-
Actual: request 2 returns HTTP 400 and the procedure never runs. The response looks like this
(abbreviated):{ "message": "Input validation failed", "code": "BAD_REQUEST", "issues": [ { "code": "invalid_type", "expected": "string", "path": ["applicationId"], "message": "Invalid input: expected string, received undefined" } ] }
Root cause
pages/api/[...trpc].ts disables the Next.js body parser
(v0.31.4, L68-L72).
As a result, @dokploy/trpc-openapi reads the body itself:
core.tschecks the media type withcontentType?.startsWith('application/json'). A header with
; charset=utf-8passes this check
(core.ts L105-L116).getBodythen compares the whole header with the string'application/json'. With a parameter,
that comparison fails, so the body is never read andreq.bodystaysundefined
(input.ts L44-L45).- The input becomes
{ ...undefined, ...pathInput }, which is{}, and Zod rejects it with a 400.
The fork inherited this comparison from the original trpc-openapi
(trpc/trpc-openapi#230). That repository is
archived and never changed it. The maintained successor fixed it in
mcampa/trpc-to-openapi#177, released in
trpc-to-openapi 3.4.0: it compares only the media type, case-insensitively. The fetch adapter in the
fork already uses includes('application/json') and is not affected.
Workaround
Send exactly Content-Type: application/json, with no parameters. In .NET, for example, set
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json") after
JsonContent.Create(...).
Existing reports
We searched issues and PRs in Dokploy/dokploy, Dokploy/trpc-openapi and trpc/trpc-openapi for
charset and content-type and found no report of this.
Fix
Fix with a regression test: Dokploy/trpc-openapi#6. After a fork release, Dokploy
needs to bump @dokploy/trpc-openapi.
- Lenguaje dominante
- TypeScript
- Estrellas
- 38.8k
- Forks
- 3.2k
- Merge medio
- 1 d 10 h
- PR fusionados (30 d)
- 110
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Dokploy/dokploy
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Dokploy/dokploy#6151 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Healthy Swarm task shows an empty `(Error:)` suffix on the last row of the Containers tabPosiblemente ocupada @AyhamJo7 la tomó hace 4 días. Abiertoneeds-triage🔍
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Dokploy/dokploy#6115 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Global search (Cmd/Ctrl+J) never sorts results by relevancePosiblemente ocupada @hamidzr la tomó hace 6 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Dokploy/dokploy#6107 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
`utils/dns/ovh.ts`: the zone-listing 403 handler replaces the provider's error instead of chaining itPosiblemente ocupada @SyncWithRaj la tomó hace 8 días. Abiertobug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
Dokploy/dokploy#6075 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
MongoDB with Replica Sets enabled: container exits with code 0 and restarts in a loop (generated startup script never waits on mongod)Posiblemente ocupada @ghazy2001 la tomó hace 10 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Dokploy/dokploy#6051 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de Dokploy/dokploy
Issues similares
-
[Bug]: RUN_STARTED resets the run's tool-call tally even when a subscriber suppresses the eventAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
ag-ui-protocol/ag-ui#3504 ·
Los mantenedores suelen responder en 1 día
-
area/profiles area/sessions comp/desktop desktop/chat desktop/sessions P2 type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
NousResearch/hermes-agent#161712 ·
Los mantenedores suelen responder en 1 día
-
bug p3
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
rothgar/rabble.radio#283 ·
Los mantenedores suelen responder en 1 día
-
bug from-app needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
nightly-labs/openbot#19805 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
OHDSI/Data2Evidence#3760 ·
Los mantenedores suelen responder en 3 días