Skip to content

Commit fc1b548

Browse files
committed
hotfix: stop debug logs and healthcheck no longer requires prisma
1 parent e84ede9 commit fc1b548

File tree

3 files changed

+93
-85
lines changed

3 files changed

+93
-85
lines changed

apps/webapp/app/routes/engine.v1.dev.runs.$runFriendlyId.logs.debug.ts

Lines changed: 60 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -11,64 +11,69 @@ import { logger } from "~/services/logger.server";
1111
import { createActionApiRoute } from "~/services/routeBuilders/apiBuilder.server";
1212
import { recordRunDebugLog } from "~/v3/eventRepository.server";
1313

14-
const { action } = createActionApiRoute(
15-
{
16-
params: z.object({
17-
runFriendlyId: z.string(),
18-
}),
19-
body: WorkerApiDebugLogBody,
20-
method: "POST",
21-
},
22-
async ({
23-
authentication,
24-
body,
25-
params,
26-
}): Promise<TypedResponse<WorkerApiRunAttemptStartResponseBody>> => {
27-
const { runFriendlyId } = params;
14+
// const { action } = createActionApiRoute(
15+
// {
16+
// params: z.object({
17+
// runFriendlyId: z.string(),
18+
// }),
19+
// body: WorkerApiDebugLogBody,
20+
// method: "POST",
21+
// },
22+
// async ({
23+
// authentication,
24+
// body,
25+
// params,
26+
// }): Promise<TypedResponse<WorkerApiRunAttemptStartResponseBody>> => {
27+
// const { runFriendlyId } = params;
2828

29-
try {
30-
const run = await prisma.taskRun.findFirst({
31-
where: {
32-
friendlyId: params.runFriendlyId,
33-
runtimeEnvironmentId: authentication.environment.id,
34-
},
35-
});
29+
// try {
30+
// const run = await prisma.taskRun.findFirst({
31+
// where: {
32+
// friendlyId: params.runFriendlyId,
33+
// runtimeEnvironmentId: authentication.environment.id,
34+
// },
35+
// });
3636

37-
if (!run) {
38-
throw new Response("You don't have permissions for this run", { status: 401 });
39-
}
37+
// if (!run) {
38+
// throw new Response("You don't have permissions for this run", { status: 401 });
39+
// }
4040

41-
const eventResult = await recordRunDebugLog(
42-
RunId.fromFriendlyId(runFriendlyId),
43-
body.message,
44-
{
45-
attributes: {
46-
properties: body.properties,
47-
},
48-
startTime: body.time,
49-
}
50-
);
41+
// const eventResult = await recordRunDebugLog(
42+
// RunId.fromFriendlyId(runFriendlyId),
43+
// body.message,
44+
// {
45+
// attributes: {
46+
// properties: body.properties,
47+
// },
48+
// startTime: body.time,
49+
// }
50+
// );
5151

52-
if (eventResult.success) {
53-
return new Response(null, { status: 204 });
54-
}
52+
// if (eventResult.success) {
53+
// return new Response(null, { status: 204 });
54+
// }
5555

56-
switch (eventResult.code) {
57-
case "FAILED_TO_RECORD_EVENT":
58-
return new Response(null, { status: 400 }); // send a 400 to prevent retries
59-
case "RUN_NOT_FOUND":
60-
return new Response(null, { status: 404 });
61-
default:
62-
return assertExhaustive(eventResult.code);
63-
}
64-
} catch (error) {
65-
logger.error("Failed to record dev log", {
66-
environmentId: authentication.environment.id,
67-
error,
68-
});
69-
throw error;
70-
}
71-
}
72-
);
56+
// switch (eventResult.code) {
57+
// case "FAILED_TO_RECORD_EVENT":
58+
// return new Response(null, { status: 400 }); // send a 400 to prevent retries
59+
// case "RUN_NOT_FOUND":
60+
// return new Response(null, { status: 404 });
61+
// default:
62+
// return assertExhaustive(eventResult.code);
63+
// }
64+
// } catch (error) {
65+
// logger.error("Failed to record dev log", {
66+
// environmentId: authentication.environment.id,
67+
// error,
68+
// });
69+
// throw error;
70+
// }
71+
// }
72+
// );
7373

74-
export { action };
74+
// export { action };
75+
76+
// Create a generic JSON action in remix
77+
export function action() {
78+
return new Response(null, { status: 204 });
79+
}

apps/webapp/app/routes/engine.v1.worker-actions.runs.$runFriendlyId.logs.debug.ts

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,39 @@ import { z } from "zod";
55
import { createActionWorkerApiRoute } from "~/services/routeBuilders/apiBuilder.server";
66
import { recordRunDebugLog } from "~/v3/eventRepository.server";
77

8-
export const action = createActionWorkerApiRoute(
9-
{
10-
params: z.object({
11-
runFriendlyId: z.string(),
12-
}),
13-
body: WorkerApiDebugLogBody,
14-
},
15-
async ({ body, params }): Promise<Response> => {
16-
const { runFriendlyId } = params;
8+
// export const action = createActionWorkerApiRoute(
9+
// {
10+
// params: z.object({
11+
// runFriendlyId: z.string(),
12+
// }),
13+
// body: WorkerApiDebugLogBody,
14+
// },
15+
// async ({ body, params }): Promise<Response> => {
16+
// const { runFriendlyId } = params;
1717

18-
const eventResult = await recordRunDebugLog(RunId.fromFriendlyId(runFriendlyId), body.message, {
19-
attributes: {
20-
properties: body.properties,
21-
},
22-
startTime: body.time,
23-
});
18+
// const eventResult = await recordRunDebugLog(RunId.fromFriendlyId(runFriendlyId), body.message, {
19+
// attributes: {
20+
// properties: body.properties,
21+
// },
22+
// startTime: body.time,
23+
// });
2424

25-
if (eventResult.success) {
26-
return new Response(null, { status: 204 });
27-
}
25+
// if (eventResult.success) {
26+
// return new Response(null, { status: 204 });
27+
// }
2828

29-
switch (eventResult.code) {
30-
case "FAILED_TO_RECORD_EVENT":
31-
return new Response(null, { status: 400 }); // send a 400 to prevent retries
32-
case "RUN_NOT_FOUND":
33-
return new Response(null, { status: 404 });
34-
default:
35-
return assertExhaustive(eventResult.code);
36-
}
37-
}
38-
);
29+
// switch (eventResult.code) {
30+
// case "FAILED_TO_RECORD_EVENT":
31+
// return new Response(null, { status: 400 }); // send a 400 to prevent retries
32+
// case "RUN_NOT_FOUND":
33+
// return new Response(null, { status: 404 });
34+
// default:
35+
// return assertExhaustive(eventResult.code);
36+
// }
37+
// }
38+
// );
39+
40+
// Create a generic JSON action in remix
41+
export function action() {
42+
return new Response(null, { status: 204 });
43+
}

apps/webapp/app/routes/healthcheck.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { prisma } from "~/db.server";
21
import type { LoaderFunction } from "@remix-run/node";
32

43
export const loader: LoaderFunction = async ({ request }) => {
54
try {
6-
await prisma.user.count();
75
return new Response("OK");
86
} catch (error: unknown) {
97
console.log("healthcheck ❌", { error });

0 commit comments

Comments
 (0)