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

オープン 初心者向け
#48 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
api, cli

調査の方向性

src/client.ts から始め、apiGet と openapi.json のクエリパラメーターの規則を比較します。dokploy compose one --composeId <valid-id> --json のようなパラメーター付きコマンドを実行し、その後、GET コマンドが名前付きのクエリキーを使用して成功することを確認します。ステータス 400 で失敗してはいけません。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
152
フォーク
46
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Dokploy/cli のほかの issue

Dokploy/cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。