Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit 4aa6549

Browse files
committed
fix(next-js): disable health check during build phase (#1409)
1 parent 39881e6 commit 4aa6549

File tree

1 file changed

+9
-1
lines changed
  • packages/rivetkit/src/remote-manager-driver

1 file changed

+9
-1
lines changed

packages/rivetkit/src/remote-manager-driver/mod.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type {
1616
} from "@/driver-helpers/mod";
1717
import type { Encoding, UniversalWebSocket } from "@/mod";
1818
import { uint8ArrayToBase64 } from "@/serde";
19-
import { combineUrlPath } from "@/utils";
19+
import { combineUrlPath, getEnvUniversal } from "@/utils";
2020
import { sendHttpRequestToActor } from "./actor-http-client";
2121
import {
2222
buildWebSocketProtocols,
@@ -56,6 +56,14 @@ export class RemoteManagerDriver implements ManagerDriver {
5656
#metadataPromise: Promise<void> | undefined;
5757

5858
constructor(runConfig: ClientConfig) {
59+
// Disable health check if in Next.js build phase since there is no `/metadata` endpoint
60+
//
61+
// See https://github.com/vercel/next.js/blob/5e6b008b561caf2710ab7be63320a3d549474a5b/packages/next/shared/lib/constants.ts#L19-L23
62+
if (getEnvUniversal("NEXT_PHASE") === "phase-production-build") {
63+
logger().info("detected next.js build phase, disabling health check");
64+
runConfig.disableHealthCheck = true;
65+
}
66+
5967
this.#config = runConfig;
6068

6169
// Perform metadata check if enabled

0 commit comments

Comments
 (0)