Dokploy / Dokploy/cli

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

Open Beginner friendly
#48 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
152
Forks
46
PR merge metrics
No merged PRs in 30d

Description

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).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/client.ts and compare apiGet with the query-parameter conventions in openapi.json. Run a parameterized command such as dokploy compose one --composeId <valid-id> --json, then check that GET commands use named query keys and return successfully instead of failing with status 400.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.