hotfix: stop debug logs and healthcheck no longer requires prisma
🚀 Publish Trigger.dev Docker / units (push) Failing after 12m16s
🚀 Publish Trigger.dev Docker / typecheck (push) Failing after 12m16s
🚀 Publish Trigger.dev Docker / publish-webapp (push) Has been skipped
🚀 Publish Trigger.dev Docker / publish-worker (push) Has been skipped
🚀 Publish Trigger.dev Docker / publish-worker-v4 (push) Has been skipped
🚀 Publish Trigger.dev Docker / units (push) Failing after 12m16s
🚀 Publish Trigger.dev Docker / typecheck (push) Failing after 12m16s
🚀 Publish Trigger.dev Docker / publish-webapp (push) Has been skipped
🚀 Publish Trigger.dev Docker / publish-worker (push) Has been skipped
🚀 Publish Trigger.dev Docker / publish-worker-v4 (push) Has been skipped
This commit is contained in:
@@ -11,64 +11,69 @@ import { logger } from "~/services/logger.server";
|
||||
import { createActionApiRoute } from "~/services/routeBuilders/apiBuilder.server";
|
||||
import { recordRunDebugLog } from "~/v3/eventRepository.server";
|
||||
|
||||
const { action } = createActionApiRoute(
|
||||
{
|
||||
params: z.object({
|
||||
runFriendlyId: z.string(),
|
||||
}),
|
||||
body: WorkerApiDebugLogBody,
|
||||
method: "POST",
|
||||
},
|
||||
async ({
|
||||
authentication,
|
||||
body,
|
||||
params,
|
||||
}): Promise<TypedResponse<WorkerApiRunAttemptStartResponseBody>> => {
|
||||
const { runFriendlyId } = params;
|
||||
// const { action } = createActionApiRoute(
|
||||
// {
|
||||
// params: z.object({
|
||||
// runFriendlyId: z.string(),
|
||||
// }),
|
||||
// body: WorkerApiDebugLogBody,
|
||||
// method: "POST",
|
||||
// },
|
||||
// async ({
|
||||
// authentication,
|
||||
// body,
|
||||
// params,
|
||||
// }): Promise<TypedResponse<WorkerApiRunAttemptStartResponseBody>> => {
|
||||
// const { runFriendlyId } = params;
|
||||
|
||||
try {
|
||||
const run = await prisma.taskRun.findFirst({
|
||||
where: {
|
||||
friendlyId: params.runFriendlyId,
|
||||
runtimeEnvironmentId: authentication.environment.id,
|
||||
},
|
||||
});
|
||||
// try {
|
||||
// const run = await prisma.taskRun.findFirst({
|
||||
// where: {
|
||||
// friendlyId: params.runFriendlyId,
|
||||
// runtimeEnvironmentId: authentication.environment.id,
|
||||
// },
|
||||
// });
|
||||
|
||||
if (!run) {
|
||||
throw new Response("You don't have permissions for this run", { status: 401 });
|
||||
}
|
||||
// if (!run) {
|
||||
// throw new Response("You don't have permissions for this run", { status: 401 });
|
||||
// }
|
||||
|
||||
const eventResult = await recordRunDebugLog(
|
||||
RunId.fromFriendlyId(runFriendlyId),
|
||||
body.message,
|
||||
{
|
||||
attributes: {
|
||||
properties: body.properties,
|
||||
},
|
||||
startTime: body.time,
|
||||
}
|
||||
);
|
||||
// const eventResult = await recordRunDebugLog(
|
||||
// RunId.fromFriendlyId(runFriendlyId),
|
||||
// body.message,
|
||||
// {
|
||||
// attributes: {
|
||||
// properties: body.properties,
|
||||
// },
|
||||
// startTime: body.time,
|
||||
// }
|
||||
// );
|
||||
|
||||
if (eventResult.success) {
|
||||
return new Response(null, { status: 204 });
|
||||
}
|
||||
// if (eventResult.success) {
|
||||
// return new Response(null, { status: 204 });
|
||||
// }
|
||||
|
||||
switch (eventResult.code) {
|
||||
case "FAILED_TO_RECORD_EVENT":
|
||||
return new Response(null, { status: 400 }); // send a 400 to prevent retries
|
||||
case "RUN_NOT_FOUND":
|
||||
return new Response(null, { status: 404 });
|
||||
default:
|
||||
return assertExhaustive(eventResult.code);
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error("Failed to record dev log", {
|
||||
environmentId: authentication.environment.id,
|
||||
error,
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
);
|
||||
// switch (eventResult.code) {
|
||||
// case "FAILED_TO_RECORD_EVENT":
|
||||
// return new Response(null, { status: 400 }); // send a 400 to prevent retries
|
||||
// case "RUN_NOT_FOUND":
|
||||
// return new Response(null, { status: 404 });
|
||||
// default:
|
||||
// return assertExhaustive(eventResult.code);
|
||||
// }
|
||||
// } catch (error) {
|
||||
// logger.error("Failed to record dev log", {
|
||||
// environmentId: authentication.environment.id,
|
||||
// error,
|
||||
// });
|
||||
// throw error;
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
export { action };
|
||||
// export { action };
|
||||
|
||||
// Create a generic JSON action in remix
|
||||
export function action() {
|
||||
return new Response(null, { status: 204 });
|
||||
}
|
||||
|
||||
@@ -5,34 +5,39 @@ import { z } from "zod";
|
||||
import { createActionWorkerApiRoute } from "~/services/routeBuilders/apiBuilder.server";
|
||||
import { recordRunDebugLog } from "~/v3/eventRepository.server";
|
||||
|
||||
export const action = createActionWorkerApiRoute(
|
||||
{
|
||||
params: z.object({
|
||||
runFriendlyId: z.string(),
|
||||
}),
|
||||
body: WorkerApiDebugLogBody,
|
||||
},
|
||||
async ({ body, params }): Promise<Response> => {
|
||||
const { runFriendlyId } = params;
|
||||
// export const action = createActionWorkerApiRoute(
|
||||
// {
|
||||
// params: z.object({
|
||||
// runFriendlyId: z.string(),
|
||||
// }),
|
||||
// body: WorkerApiDebugLogBody,
|
||||
// },
|
||||
// async ({ body, params }): Promise<Response> => {
|
||||
// const { runFriendlyId } = params;
|
||||
|
||||
const eventResult = await recordRunDebugLog(RunId.fromFriendlyId(runFriendlyId), body.message, {
|
||||
attributes: {
|
||||
properties: body.properties,
|
||||
},
|
||||
startTime: body.time,
|
||||
});
|
||||
// const eventResult = await recordRunDebugLog(RunId.fromFriendlyId(runFriendlyId), body.message, {
|
||||
// attributes: {
|
||||
// properties: body.properties,
|
||||
// },
|
||||
// startTime: body.time,
|
||||
// });
|
||||
|
||||
if (eventResult.success) {
|
||||
return new Response(null, { status: 204 });
|
||||
}
|
||||
// if (eventResult.success) {
|
||||
// return new Response(null, { status: 204 });
|
||||
// }
|
||||
|
||||
switch (eventResult.code) {
|
||||
case "FAILED_TO_RECORD_EVENT":
|
||||
return new Response(null, { status: 400 }); // send a 400 to prevent retries
|
||||
case "RUN_NOT_FOUND":
|
||||
return new Response(null, { status: 404 });
|
||||
default:
|
||||
return assertExhaustive(eventResult.code);
|
||||
}
|
||||
}
|
||||
);
|
||||
// switch (eventResult.code) {
|
||||
// case "FAILED_TO_RECORD_EVENT":
|
||||
// return new Response(null, { status: 400 }); // send a 400 to prevent retries
|
||||
// case "RUN_NOT_FOUND":
|
||||
// return new Response(null, { status: 404 });
|
||||
// default:
|
||||
// return assertExhaustive(eventResult.code);
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
// Create a generic JSON action in remix
|
||||
export function action() {
|
||||
return new Response(null, { status: 204 });
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { prisma } from "~/db.server";
|
||||
import type { LoaderFunction } from "@remix-run/node";
|
||||
|
||||
export const loader: LoaderFunction = async ({ request }) => {
|
||||
try {
|
||||
await prisma.user.count();
|
||||
return new Response("OK");
|
||||
} catch (error: unknown) {
|
||||
console.log("healthcheck ❌", { error });
|
||||
|
||||
Reference in New Issue
Block a user