Skip to content

Getting "Request failed with status code 400" on every project or app request #39

Description

@yagee

Hi all, thanks for great app!

I am succesfully auth to my panel, after that I call dokploy project all and recieve all my projects

Image

After that I call dokploy project one --projectId IawXPym-JdmnSI0_g82Wa

And I have same error every time (I tried multiple projects and applications)

Image

dokploy --version
0.3.0

Activity

  1. marijnbent commented on Apr 23, 2026

    @marijnbent

    same

  2. Glowvan commented on Apr 23, 2026

    @Glowvan

    Same here, 400 on every project/app request. Looks like the CLI calls /trpc/ endpoints but the server only responds on /api/ REST endpoints. Probably a mismatch between the shipped dist and the server version.

  3. added a commit that references this issue on Apr 27, 2026
    feb6113
  4. sentydeploy commented on May 13, 2026

    @sentydeploy

    Confirming this is still broken in @dokploy/cli@0.29.4 against a fresh Dokploy v0.29.4 server.

    Root cause

    apiGet in src/client.ts sends raw input, but the tRPC v10 backend expects the transformer wrapper {json: ...}. Compare with apiPost in the same file:

    // apiPost — wraps correctly
    const response = await client.post(
        `/trpc/${endpoint}`,
        data ? { json: data } : undefined,
    );
    
    // apiGet — missing the wrap
    const query = params
        ? `?input=${encodeURIComponent(JSON.stringify(params))}`
        : "";

    Server confirms

    # Without {json:...} wrap (current CLI behavior) — fails
    $ curl -sk -H "x-api-key: $TOKEN" \
        "https://panel.example.com/api/trpc/application.one?input=$(node -e 'console.log(encodeURIComponent(JSON.stringify({applicationId:"X"})))')"
    {"error":{"json":{"message":"...Invalid input: expected object, received undefined...","data":{"code":"BAD_REQUEST","httpStatus":400}}}}
    
    # With {json:...} wrap — works
    $ curl -sk -H "x-api-key: $TOKEN" \
        "https://panel.example.com/api/trpc/application.one?input=$(node -e 'console.log(encodeURIComponent(JSON.stringify({json:{applicationId:"X"}})))')"
    {"result":{"data":{"json":{...full app config...}}}}

    Suggested fix (1 line)

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

    Scope

    Affects every apiGet command with arguments: *.one, *.byProjectId, *.byApplicationId, *.byComposeId, *.allByType, etc. — basically all single-item / filtered reads.

    Unaffected:

    • apiPost commands (write ops like *.create, *.update, *.deploy) — already wrap correctly.
    • apiGet commands without params (project.all, application.search with no filters) — no input sent, so no wrap needed.

    Happy to send a PR if maintainers prefer.

  5. ralphwest1 commented on May 20, 2026

    @ralphwest1

    I'm trying Dokploy for the first time and spent over an hour troubleshooting this before finding this thread. Huge thanks to @sentydeploy for summarizing the root cause so clearly. I would love to see a fix pushed for this soon!

  6. zhom commented on May 24, 2026

    @zhom

    Without sentydeploy's fix, the CLI has very limited application. Most of application, deployment, docker, compose, and other commands are broken. This prevents interaction with the backend without having to use GUI or building custom tooling around the API. @jcdang @hamidzr please take a look.

  7. jaredmcqueen commented on Jul 17, 2026

    @jaredmcqueen

    Hi! Is there an ETA for a new CLI release that includes this fix? This issue is currently blocking some of our automated CI/CD workflows, so having an official build would be a huge help. We're compiling from source as a temporary workaround, but we'd love to get back to an official release whenever it's ready. Thanks for your work on this!

    @Siumauricio

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