Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/counter-serverless/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ import { registry } from "./registry";
registry.start({
runnerKind: "serverless",
autoConfigureServerless: { url: "http://localhost:8080" },
endpoint: "http://localhost:6420",
});
4 changes: 0 additions & 4 deletions packages/next-js/src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ export const toNextHandler = (
// Configure serverless
inputConfig.runnerKind = "serverless";

// TODO: We probably want to move this to the registry for all serverless runners
// Metadata endpoint will not exist at 127.0.0.1:6420
inputConfig.disableHealthCheck = true;

// Auto-configure serverless runner if not in prod
if (process.env.NODE_ENV !== "production") {
logger().debug(
Expand Down
27 changes: 25 additions & 2 deletions packages/rivetkit/src/registry/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,25 @@ export class Registry<A extends RegistryActors> {
// Promise for any async operations we need to wait to complete
const readyPromises = [];

// Disable health check if using serverless
//
// This is because the endpoint will not be configured until we receive
// a serverless runner request, so we do not know what to health check
if (config.runnerKind === "serverless") {
logger().debug("disabling health check since using serverless");
config.disableHealthCheck = true;
}

// Auto-configure serverless runner if not in prod
if (
process.env.NODE_ENV !== "production" &&
config.runnerKind === "serverless"
) {
if (inputConfig?.runEngine === undefined) config.runEngine = true;
if (inputConfig?.autoConfigureServerless === undefined)
config.autoConfigureServerless = true;
}

// Start engine
if (config.runEngine) {
logger().debug({
Expand Down Expand Up @@ -185,6 +204,7 @@ export class Registry<A extends RegistryActors> {
// Even though we do not use the returned ActorDriver, this is required to start the code that will handle incoming actors
if (!config.disableActorDriver) {
Promise.all(readyPromises).then(async () => {
logger().debug("starting actor driver");
driver.actor(this.#config, config, managerDriver, client);
});
}
Expand Down Expand Up @@ -220,6 +240,8 @@ export class Registry<A extends RegistryActors> {
}

async function configureServerlessRunner(config: RunnerConfig): Promise<void> {
logger().debug("configuring serverless runner");

try {
// Ensure we have required config values
if (!config.runnerName) {
Expand Down Expand Up @@ -290,10 +312,11 @@ async function configureServerlessRunner(config: RunnerConfig): Promise<void> {
});
} catch (error) {
logger().error({
msg: "failed to configure serverless runner",
msg: "failed to configure serverless runner, validate endpoint is configured correctly then restart this process",
error,
});
throw error;

// Don't throw, allow the runner to continue
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/rivetkit/src/remote-manager-driver/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class RemoteManagerDriver implements ManagerDriver {
});
} catch (error) {
logger().error({
msg: "failed to connect to metadata endpoint",
msg: "health check failed, validate the Rivet endpoint is configured correctly",
endpoint,
error: stringifyError(error),
});
Expand Down
Loading