Skip to content

Open-source status page, incident response and uptime monitoring

no embedded replica (#2211)

Thibault Le Ouayb534223092a5
diff --git a/apps/workflows/src/cron/checker.ts b/apps/workflows/src/cron/checker.ts
index edcf7a4cd..96d466087 100644
--- a/apps/workflows/src/cron/checker.ts
+++ b/apps/workflows/src/cron/checker.ts
@@ -12,6 +12,7 @@ import {
lte,
notInArray,
} from "@openstatus/db";
+import { db } from "@openstatus/db";
import {
type MonitorStatus,
maintenance,
@@ -26,7 +27,6 @@ import {
pageComponent,
} from "@openstatus/db/src/schema/page_components";
import { regionDict } from "@openstatus/regions";
-import { db } from "../lib/db";
import { getLogger } from "@logtape/logtape";
import type { monitorPeriodicitySchema } from "@openstatus/db/src/schema/constants";
diff --git a/apps/workflows/src/cron/external-status.ts b/apps/workflows/src/cron/external-status.ts
index 642e7b110..934d9326b 100644
--- a/apps/workflows/src/cron/external-status.ts
+++ b/apps/workflows/src/cron/external-status.ts
@@ -16,8 +16,8 @@ import { OSTinybird } from "@openstatus/tinybird";
import { Effect } from "effect";
import type { Context } from "hono";
+import { db } from "@openstatus/db";
import { env } from "../env";
-import { db } from "../lib/db";
import { reportBackgroundError, runSentryCron } from "../lib/sentry";
const logger = getLogger(["workflow", "external-status"]);
diff --git a/apps/workflows/src/cron/index.ts b/apps/workflows/src/cron/index.ts
index 19e70dd0c..a1516c07e 100644
--- a/apps/workflows/src/cron/index.ts
+++ b/apps/workflows/src/cron/index.ts
@@ -44,7 +44,19 @@ app.get("/checker/:period", async (c) => {
void Effect.runPromise(
Effect.tryPromise({
try: () => sendCheckerTasks(periodicity),
- catch: (e) => new Error(`Error in /checker/${periodicity} cron: ${e}`),
+ // Surface `cause` — DrizzleQueryError stringifies to "Failed query: …"
+ // without the underlying libSQL reason, so callers see no hint of *why*
+ // the query failed unless we flatten the cause into the message.
+ catch: (e) => {
+ const causeMessage =
+ e instanceof Error && e.cause instanceof Error
+ ? `\nCause: ${e.cause.message}`
+ : "";
+ return new Error(
+ `Error in /checker/${periodicity} cron: ${e}${causeMessage}`,
+ { cause: e },
+ );
+ },
}).pipe(
Effect.retry({
times: 3,