Skip to content

Compose GitHub auto-deploy webhook crashes when Watch Paths are enabled and commits have missing modified entries #4081

@jakvbs

Description

@jakvbs

To Reproduce

  1. Create a Compose service using the GitHub provider.
  2. Enable Auto Deploy.
  3. Configure at least one Watch Paths entry.
  4. Push a commit where the GitHub webhook payload has missing or partial changed-file arrays in commits.
    • for example, modified is missing
    • or the only paths are present in added / removed
  5. Let GitHub call the Dokploy compose webhook.

Current vs. Expected behavior

Current behavior:

  • the webhook reaches Dokploy
  • the compose deploy endpoint crashes before enqueueing the deployment
  • auto-deploy does not happen
  • server logs show TypeError: Expected input to be a string

Expected behavior:

  • Dokploy should not throw
  • missing or partial changed-file arrays should be handled safely
  • watch path matching should either correctly evaluate the changed files or return "no match" without crashing

Provide environment information

Operating System:
  OS: Ubuntu 24.04.4 LTS
  Arch: x86_64
Dokploy version: v0.28.8
VPS Provider: Hetzner
What applications/services are you trying to deploy?
  Docker Compose service backed by a GitHub repo with Auto Deploy + Watch Paths enabled

Which area(s) are affected? (Select all that apply)

Docker Compose

Are you deploying the applications where Dokploy is installed or on a remote server?

Same server where Dokploy is installed

Additional context

The crash happens in the compose webhook path, not in GitHub delivery itself.

Observed server log:

TypeError: Expected input to be a string
    at ...
    at ... /api/deploy/compose/[refreshToken].js

The current compose webhook handler builds changed files only from commit.modified and passes that directly into watch path matching.

Relevant code paths:

  • apps/dokploy/pages/api/deploy/compose/[refreshToken].ts
  • apps/dokploy/pages/api/deploy/[refreshToken].ts
  • apps/dokploy/pages/api/deploy/github.ts
  • packages/server/src/utils/watch-paths/should-deploy.ts

Current shape:

const normalizedCommits = req.body?.commits?.flatMap(
  (commit: any) => commit.modified,
);

const shouldDeployPaths = shouldDeploy(
  composeResult.watchPaths,
  normalizedCommits,
);

And:

export const shouldDeploy = (
  watchPaths: string[] | null,
  modifiedFiles: string[],
): boolean => {
  if (!watchPaths || watchPaths?.length === 0) return true;
  return micromatch.some(modifiedFiles, watchPaths);
};

This throws when modifiedFiles is undefined or contains nullish values.

I reproduced the crash locally with:

shouldDeploy(["steam/**"], undefined as any)
shouldDeploy(["steam/**"], [undefined] as any)

Both throw:

TypeError: Expected input to be a string

I also verified that webhook payload normalization is incomplete today because it ignores added and removed paths and only reads modified.

Will you send a PR to fix it?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions