diff --git a/apps/dokploy/pages/api/deploy/compose/[refreshToken].ts b/apps/dokploy/pages/api/deploy/compose/[refreshToken].ts index 640a2531d..e22149f35 100644 --- a/apps/dokploy/pages/api/deploy/compose/[refreshToken].ts +++ b/apps/dokploy/pages/api/deploy/compose/[refreshToken].ts @@ -53,9 +53,10 @@ export default async function handler( if (sourceType === "github") { const branchName = extractBranchName(req.headers, req.body); - const normalizedCommits = req.body?.commits?.flatMap( - (commit: any) => commit.modified, - ); + const normalizedCommits = + req.body?.commits?.flatMap( + (commit: any) => commit.modified, + ) || []; const shouldDeployPaths = shouldDeploy( composeResult.watchPaths, @@ -73,9 +74,10 @@ export default async function handler( } } else if (sourceType === "gitlab") { const branchName = extractBranchName(req.headers, req.body); - const normalizedCommits = req.body?.commits?.flatMap( - (commit: any) => commit.modified, - ); + const normalizedCommits = + req.body?.commits?.flatMap( + (commit: any) => commit.modified, + ) || []; const shouldDeployPaths = shouldDeploy( composeResult.watchPaths, @@ -124,17 +126,20 @@ export default async function handler( let normalizedCommits: string[] = []; if (provider === "github") { - normalizedCommits = req.body?.commits?.flatMap( - (commit: any) => commit.modified, - ); + normalizedCommits = + req.body?.commits?.flatMap( + (commit: any) => commit.modified, + ) || []; } else if (provider === "gitlab") { - normalizedCommits = req.body?.commits?.flatMap( - (commit: any) => commit.modified, - ); + normalizedCommits = + req.body?.commits?.flatMap( + (commit: any) => commit.modified, + ) || []; } else if (provider === "gitea") { - normalizedCommits = req.body?.commits?.flatMap( - (commit: any) => commit.modified, - ); + normalizedCommits = + req.body?.commits?.flatMap( + (commit: any) => commit.modified, + ) || []; } const shouldDeployPaths = shouldDeploy( @@ -149,9 +154,10 @@ export default async function handler( } else if (sourceType === "gitea") { const branchName = extractBranchName(req.headers, req.body); - const normalizedCommits = req.body?.commits?.flatMap( - (commit: any) => commit.modified, - ); + const normalizedCommits = + req.body?.commits?.flatMap( + (commit: any) => commit.modified, + ) || []; const shouldDeployPaths = shouldDeploy( composeResult.watchPaths, diff --git a/apps/dokploy/pages/api/deploy/github.ts b/apps/dokploy/pages/api/deploy/github.ts index 4438366f6..82106ef2c 100644 --- a/apps/dokploy/pages/api/deploy/github.ts +++ b/apps/dokploy/pages/api/deploy/github.ts @@ -213,9 +213,10 @@ export default async function handler( const deploymentTitle = extractCommitMessage(req.headers, req.body); const deploymentHash = extractHash(req.headers, req.body); const owner = githubBody?.repository?.owner?.name; - const normalizedCommits = githubBody?.commits?.flatMap( - (commit: any) => commit.modified, - ); + const normalizedCommits = + githubBody?.commits?.flatMap( + (commit: any) => commit.modified, + ) || []; const apps = await db.query.applications.findMany({ where: and(