The healthcheck doesn’t need to do a HEAD request to /
🚀 Publish Trigger.dev Docker / e2e (push) Failing after 13m7s
🚀 Publish Trigger.dev Docker / units (push) Failing after 13m7s
🚀 Publish Trigger.dev Docker / typecheck (push) Failing after 13m8s
🚀 Publish Trigger.dev Docker / publish (push) Has been skipped

This commit is contained in:
Matt Aitken
2023-12-07 13:40:12 +00:00
parent caeacc654d
commit e65fc77d1c
+1 -16
View File
@@ -1,24 +1,9 @@
// learn more: https://fly.io/docs/reference/configuration/#services-http_checks
import { prisma } from "~/db.server";
import type { LoaderFunction } from "@remix-run/node";
export const loader: LoaderFunction = async ({ request }) => {
const host = request.headers.get("X-Forwarded-Host") ?? request.headers.get("host");
try {
const url = new URL("/", `http://${host}`);
if (request.headers.get("x-forwarded-proto") === "https") {
url.protocol = "https:";
}
// if we can connect to the database and make a simple query
// and make a HEAD request to ourselves, then we're good.
await Promise.all([
prisma.user.count(),
fetch(url.href, { method: "HEAD" }).then((r) => {
if (!r.ok) return Promise.reject(r);
}),
]);
await prisma.user.count();
return new Response("OK");
} catch (error: unknown) {
console.log("healthcheck ❌", { error });