Skip to content

fix: wrap GET input params in tRPC v11 { json } envelope - #52

Open
gooyoung wants to merge 1 commit into
Dokploy:mainfrom
gooyoung:fix/api-get-trpc-v11-input
Open

fix: wrap GET input params in tRPC v11 { json } envelope#52
gooyoung wants to merge 1 commit into
Dokploy:mainfrom
gooyoung:fix/api-get-trpc-v11-input

Conversation

@gooyoung

Copy link
Copy Markdown

Fixes #48

What / Why

Previously, apiGet() serialized GET input query params as a bare JSON object:

`?input=${encodeURIComponent(JSON.stringify(params))}`

tRPC v11 servers (Dokploy server >= 0.30, @trpc/server@11) require the GET input query param to be wrapped in a { json: ... } envelope. A bare object deserializes to undefined, causing every read-only command with query params (e.g., application.search, compose one, project one, *.readLogs) to fail with:

Invalid input: expected object, received undefined (HTTP 400)

This PR updates apiGet() to send { json: params } — the exact shape tRPC v11 requires. This envelope format is also fully backward compatible with older tRPC v10 servers, ensuring the CLI continues to work against all Dokploy server versions.

Verification

  • dokploy application search --limit 1 against Dokploy server 0.30.2 (tRPC v11):
    • Before: HTTP 400
    • After: HTTP 200 with results
  • environment.search with full query params: HTTP 200
  • Added 2 unit tests asserting exact URL construction (with and without params).
  • vitest run: 20/20 passed.

Note: The alternative fix suggested in the issue (named query params via { params }) was also tested against a tRPC v11 server, but it still returns HTTP 400. Only the { json: ... } envelope works, and it maintains backward compatibility with tRPC v10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

apiGet sends params as ?input=<JSON> instead of named query params — all GET commands with parameters fail (400)

1 participant