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

Commit cb08087

Browse files
committed
fix(next-js): disable health check during build phase
1 parent 9d4fdc2 commit cb08087

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/rivetkit/src/client/client.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { Encoding } from "@/actor/protocol/serde";
44
import type { ManagerDriver } from "@/driver-helpers/mod";
55
import type { ActorQuery } from "@/manager/protocol/query";
66
import type { Registry } from "@/registry/mod";
7+
import { getEnvUniversal } from "@/utils";
78
import type { ActorActionFunction } from "./actor-common";
89
import {
910
type ActorConn,
@@ -170,6 +171,14 @@ export class ClientRaw {
170171
* Creates an instance of Client.
171172
*/
172173
public constructor(driver: ManagerDriver, config: ClientConfig) {
174+
// Disable health check if in Next.js build phase since there is no `/metadata` endpoint
175+
//
176+
// See https://github.com/vercel/next.js/blob/5e6b008b561caf2710ab7be63320a3d549474a5b/packages/next/shared/lib/constants.ts#L19-L23
177+
if (getEnvUniversal("NEXT_PHASE") === "phase-production-build") {
178+
logger().info("detected next.js build phase, disabling health check");
179+
config.disableHealthCheck = true;
180+
}
181+
173182
this.#driver = driver;
174183

175184
this.#encodingKind = config.encoding ?? "bare";

0 commit comments

Comments
 (0)