Skip to content

Commit 17e9154

Browse files
authored
Merge pull request #2257 from Dokploy/fix/send-build-error-on-remote-servers
Fix/send build error on remote servers
2 parents 4e9630e + 2442494 commit 17e9154

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/server/src/services/application.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ export const deployApplication = async ({
237237
} catch (error) {
238238
await updateDeploymentStatus(deployment.deploymentId, "error");
239239
await updateApplicationStatus(applicationId, "error");
240+
240241
await sendBuildErrorNotifications({
241242
projectName: application.project.name,
242243
applicationName: application.name,
@@ -370,8 +371,9 @@ export const deployRemoteApplication = async ({
370371
domains: application.domains,
371372
});
372373
} catch (error) {
373-
// @ts-ignore
374-
const encodedContent = encodeBase64(error?.message);
374+
const errorMessage = error instanceof Error ? error.message : String(error);
375+
376+
const encodedContent = encodeBase64(errorMessage);
375377

376378
await execAsyncRemote(
377379
application.serverId,
@@ -383,12 +385,12 @@ export const deployRemoteApplication = async ({
383385

384386
await updateDeploymentStatus(deployment.deploymentId, "error");
385387
await updateApplicationStatus(applicationId, "error");
388+
386389
await sendBuildErrorNotifications({
387390
projectName: application.project.name,
388391
applicationName: application.name,
389392
applicationType: "application",
390-
// @ts-ignore
391-
errorMessage: error?.message || "Error building",
393+
errorMessage: `Please check the logs for details: ${errorMessage}`,
392394
buildLink,
393395
organizationId: application.project.organizationId,
394396
});

packages/server/src/utils/notifications/build-error.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export const sendBuildErrorNotifications = async ({
6565
const decorate = (decoration: string, text: string) =>
6666
`${discord.decoration ? decoration : ""} ${text}`.trim();
6767

68+
const limitCharacter = 800;
69+
const truncatedErrorMessage = errorMessage.substring(0, limitCharacter);
6870
await sendDiscordNotification(discord, {
6971
title: decorate(">", "`⚠️` Build Failed"),
7072
color: 0xed4245,
@@ -101,7 +103,7 @@ export const sendBuildErrorNotifications = async ({
101103
},
102104
{
103105
name: decorate("`⚠️`", "Error Message"),
104-
value: `\`\`\`${errorMessage}\`\`\``,
106+
value: `\`\`\`${truncatedErrorMessage}\`\`\``,
105107
},
106108
{
107109
name: decorate("`🧷`", "Build Link"),

0 commit comments

Comments
 (0)