-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathengine.v1.dev.runs.$runFriendlyId.logs.debug.ts
More file actions
79 lines (71 loc) · 2.31 KB
/
engine.v1.dev.runs.$runFriendlyId.logs.debug.ts
File metadata and controls
79 lines (71 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { TypedResponse } from "@remix-run/server-runtime";
import { assertExhaustive } from "@trigger.dev/core/utils";
import { RunId } from "@trigger.dev/core/v3/isomorphic";
import {
WorkerApiDebugLogBody,
WorkerApiRunAttemptStartResponseBody,
} from "@trigger.dev/core/v3/workers";
import { z } from "zod";
import { prisma } from "~/db.server";
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;
// 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 });
// }
// 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 });
// }
// 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 };
// Create a generic JSON action in remix
export function action() {
return new Response(null, { status: 204 });
}