Skip to content

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

Open

Description

@decodevM

Problem

Any CLI command that maps to a GET endpoint with query parameters fails:

dokploy compose one --composeId <valid-id> --json
# Request failed with status code 400

This affects every "read one" / "search" style command across the API (compose one, application one, project one, mysql one, registry one, *.search, *.readLogs, etc. — anything backed by a GET with query params in openapi.json). Commands backed by POST (deploy, delete, update, create) are unaffected.

Root cause

In src/client.ts:

export async function apiGet(
	endpoint: string,
	params?: Record<string, unknown>,
) {
	const client = createClient();
	const query = params
		? `?input=${encodeURIComponent(JSON.stringify(params))}`
		: "";
	const response = await client.get(`/trpc/${endpoint}${query}`);
	return response.data?.result?.data?.json ?? response.data;
}

This wraps all params into one JSON-encoded input query string — the convention for calling tRPC procedures directly. But the REST surface this CLI actually targets (per its own openapi.json) expects each parameter as its own named query key, e.g. ?composeId=<id>, not a JSON blob under input.

Confirmed directly: the same request, same auth, sent as a plain named query param instead of through the CLI, succeeds:

curl -s -H "x-api-key: $DOKPLOY_AUTH_TOKEN" \
  "https://<host>/api/compose.one?composeId=<valid-id>"
# returns the full object correctly

Suggested fix

const response = await client.get(`/trpc/${endpoint}`, { params });

Environment

@dokploy/cli 0.29.14 (also reproduced on 0.3.0 — not version-specific).

Activity

  1. R-udren commented on Aug 29, 2026

    @R-udren

    Ran into this too on 0.30.2 — every GET command with params 400s for me (read-logs, *.one, search, ...), POST stuff like deploy works fine.

    Tried the fix suggested here and it didn't work for me, server still returns 400 with "Invalid input: expected object, received undefined" when passing named query params to /trpc/.

    What did work: wrapping the params in { json: ... } before encoding:

    const query = params
    	? `?input=${encodeURIComponent(JSON.stringify({ json: params }))}`
    	: "";

    Hitting the plain REST routes directly also works — GET /api/application.readLogs?applicationId=...&tail=5 returns 200 — so fixing it that way could work too if that matches openapi.json better.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions