@resonatehq/gcp is the official binding to run Resonate durable execution workers on Google Cloud Functions. Write long-running, stateful applications on short-lived, stateless serverless infrastructure.
npm install @resonatehq/gcpWhen a Durable Function suspends (e.g. on yield* context.rpc() or context.sleep()), the Cloud Function terminates. When the Durable Promise completes, the Resonate Server resumes the function by invoking it again — no long-running process required.
Register your functions and export the HTTP handler from your Cloud Function entry point:
import { Resonate } from "@resonatehq/gcp";
import type { Context } from "@resonatehq/gcp";
const resonate = new Resonate();
resonate.register("countdown", function* countdown(ctx: Context, n: number): Generator {
if (n <= 0) {
console.log("done");
return;
}
console.log(n);
yield* ctx.sleep(1000);
yield* ctx.rpc(countdown, n - 1);
});
// Export as a Google Cloud Functions HTTP handler
export const handler = resonate.httpHandler();Deploy this as a Google Cloud Function with an HTTP trigger. The Resonate Server will call your handler to invoke and resume durable functions.
See the Google Cloud Functions documentation to learn how to develop and deploy Cloud Functions.
Full documentation: docs.resonatehq.io