From cd527f2bceb6af2cc9233531c49f4686a20037a0 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 10 Feb 2022 21:56:19 +0100 Subject: [PATCH 1/4] fix: Capture non-error as error --- src/lib/database/common.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/database/common.ts b/src/lib/database/common.ts index 816082d85..c79e9d101 100644 --- a/src/lib/database/common.ts +++ b/src/lib/database/common.ts @@ -37,6 +37,9 @@ if (dev) { export const prisma = new PrismaClient(prismaOptions); export function PrismaErrorHandler(e) { + if (e! instanceof Error) { + e = new Error(e.toString()); + } sentry.captureException(e); const payload = { status: e.status || 500, From 5089c843b61a32e6db96a2517261f07e2a208949 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 10 Feb 2022 21:56:44 +0100 Subject: [PATCH 2/4] chore: Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7928841b0..6be8784cf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "coolify", "description": "An open-source & self-hostable Heroku / Netlify alternative.", - "version": "2.0.2", + "version": "2.0.3", "license": "AGPL-3.0", "scripts": { "dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0", From 73fc9755ddfe524fbb95f33b000b57f9697d05f3 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 10 Feb 2022 22:06:22 +0100 Subject: [PATCH 3/4] fix: Only delete id.rsa in case of it exists --- src/lib/queues/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/queues/index.ts b/src/lib/queues/index.ts index a686fb04c..8a0d0ecb8 100644 --- a/src/lib/queues/index.ts +++ b/src/lib/queues/index.ts @@ -122,7 +122,9 @@ buildWorker.on('completed', async (job: Bullmq.Job) => { } finally { const workdir = `/tmp/build-sources/${job.data.repository}/${job.data.build_id}`; await asyncExecShell(`rm -fr ${workdir}`); - await asyncExecShell(`rm /tmp/build-sources/${job.data.repository}/id.rsa`); + await asyncExecShell( + `test -f /tmp/build-sources/${job.data.repository}/id.rsa && rm /tmp/build-sources/${job.data.repository}/id.rsa` + ); } return; }); @@ -136,7 +138,9 @@ buildWorker.on('failed', async (job: Bullmq.Job, failedReason) => { } finally { const workdir = `/tmp/build-sources/${job.data.repository}/${job.data.build_id}`; await asyncExecShell(`rm -fr ${workdir}`); - await asyncExecShell(`rm /tmp/build-sources/${job.data.repository}/id.rsa`); + await asyncExecShell( + `test -f /tmp/build-sources/${job.data.repository}/id.rsa && rm /tmp/build-sources/${job.data.repository}/id.rsa` + ); } saveBuildLog({ line: 'Failed build!', buildId: job.data.build_id, applicationId: job.data.id }); saveBuildLog({ From f514aa676d7bbac84c6c51c2ca2badddd746ca79 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 10 Feb 2022 22:10:02 +0100 Subject: [PATCH 4/4] fix: Status is not available yet --- src/routes/applications/[id]/logs/build/build.json.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/applications/[id]/logs/build/build.json.ts b/src/routes/applications/[id]/logs/build/build.json.ts index 38a51e043..da6956939 100644 --- a/src/routes/applications/[id]/logs/build/build.json.ts +++ b/src/routes/applications/[id]/logs/build/build.json.ts @@ -14,12 +14,12 @@ export const get: RequestHandler = async (event) => { where: { buildId, time: { gt: sequence } }, orderBy: { time: 'asc' } }); - const { status } = await db.prisma.build.findFirst({ where: { id: buildId } }); + const data = await db.prisma.build.findFirst({ where: { id: buildId } }); return { body: { logs, - status + status: data?.status || 'running' } }; } catch (error) {