Skip to main content

Deploy using a serverless (FaaS) worker shim

Currently only the TypeScript SDK supports serverless worker shims.

What is a serverless worker shim?

A serverless worker shim, also referred to as a binding, is a lightweight adapter that allows Resonate Workers to run in serverless (FaaS) environments such as Cloudflare Workers, AWS Lambda, Google Cloud Functions, etc. The shim handles the communication between the Resonate SDK and the serverless platform, allowing you to run long-running workflows in ephemeral serverless functions with relative ease.

Supported platforms

The following serverless platforms are supported with official Resonate worker shims:

AWS Lambda

Amazon Lambda worker shim | TypeScript

Quick example:

Install the shim package
Shell
npm install @resonatehq/aws

Instead of importing Resonate from the SDK package, import it from the AWS shim package.

index.ts
TypeScript
import { Resonate } from "@resonatehq/aws";
import { countdown } from "./count";

const resonate = new Resonate();

resonate.register("countdown", countdown);

export const handler = resonate.httpHandler();

Cloudflare Workers

Cloudflare Workers worker shim | TypeScript

Quick example:

Install the shim package
Shell
npm install @resonatehq/cloudflare

Instead of importing Resonate from the SDK package, import it from the Cloudflare shim package.

index.ts
TypeScript
import { Resonate } from "@resonatehq/cloudflare";
import { countdown } from "./count";

const resonate = new Resonate();

resonate.register("countdown", countdown);

export default resonate.handlerHttp();

Ready to use example apps:

Google Cloud Functions

Google Cloud Functions worker shim | TypeScript

Quick example:

Install the shim package
Shell
npm install @resonatehq/gcp

Instead of importing Resonate from the SDK package, import it from the GCP shim package.

index.ts
TypeScript
import { Resonate } from "@resonatehq/gcp";
import { countdown } from "./count";

const resonate = new Resonate();

resonate.register("countdown", countdown);

export const handler = resonate.handlerHttp();

Ready to use example apps:

Supabase Edge Functions

Supabase Edge Functions worker shim | TypeScript

Quick example:

Install the shim package
Shell
npm install @resonatehq/supabase

Instead of importing Resonate from the SDK package, import it from the Supabase shim package.

index.ts
TypeScript
import { Resonate } from "@resonatehq/supabase";
import { countdown } from "./count";

const resonate = new Resonate();
resonate.register("countdown", countdown);

resonate.httpHandler();

Ready to use example apps: