Add ability to disable the prisma query in the healthcheck endpoint (#2242)

This commit is contained in:
Eric Allam
2025-07-07 16:41:55 +01:00
committed by GitHub
parent b36d81a622
commit 493ca11c43
2 changed files with 7 additions and 0 deletions
+2
View File
@@ -930,6 +930,8 @@ const EnvironmentSchema = z.object({
// CLI package tag (e.g. "latest", "v4-beta", "4.0.0") - used for setup commands
TRIGGER_CLI_TAG: z.string().default("latest"),
HEALTHCHECK_DATABASE_DISABLED: z.string().default("0"),
});
export type Environment = z.infer<typeof EnvironmentSchema>;
+5
View File
@@ -1,8 +1,13 @@
import { prisma } from "~/db.server";
import type { LoaderFunction } from "@remix-run/node";
import { env } from "~/env.server";
export const loader: LoaderFunction = async ({ request }) => {
try {
if (env.HEALTHCHECK_DATABASE_DISABLED === "1") {
return new Response("OK");
}
await prisma.$queryRaw`SELECT 1`;
return new Response("OK");
} catch (error: unknown) {