Documentation Index
Fetch the complete documentation index at: https://mintlify.com/eersnington/sideffect/llms.txt
Use this file to discover all available pages before exploring further.
WorkflowEntrypoints is the Cloudflare-specific adapter that converts Sideffect WorkflowLayer values into native Cloudflare WorkflowEntrypoint subclass constructors. Use it in a plain Cloudflare Worker — without Vite — when you want to wire up Sideffect workflows manually. Import it from sideffect/cloudflare.
WorkflowEntrypoints.make()
Function signature
Parameters
A plain object whose keys are
class_name strings — the Cloudflare Workflow class names that
appear in your Wrangler config — and whose values are WorkflowLayer instances created by
Workflow.make(...).toLayer(...).Each key becomes a named export that Cloudflare’s runtime uses to route incoming workflow
invocations. Keys must be valid JavaScript identifiers (the same rule Cloudflare enforces for
WorkflowEntrypoint class names in Wrangler config).Return value
An object with the same keys as
entries. Each value is a WorkflowEntrypoint subclass
constructor. Destructure and export the keys whose names match the class_name values in your
Wrangler workflow bindings.Validation
WorkflowEntrypoints.make() validates every entry before returning and throws synchronously on the
first violation:
-
Invalid
class_nameidentifier — if a key is not a valid JavaScript identifier (tested against/^[$A-Z_a-z][$\w]*$/), aTypeErroris thrown: -
Value is not a
WorkflowLayer— if a value does not have_tag === "WorkflowLayer", aTypeErroris thrown:
Examples
Single workflow
wrangler.toml should have a matching binding:
Multiple workflows
Re-exporting with a different local name
When your layer variable name differs from the requiredclass_name, rename it at the export site
rather than renaming the layer itself:
Runtime behaviour
At workflow invocation time Cloudflare calls therun(event, step) method on the generated
WorkflowEntrypoint subclass. Internally the generated class delegates to
WorkflowEngine.run(), which:
-
Decodes the payload — runs the workflow’s
payloadSchemaagainstevent.payload. If decoding fails the error is converted to aNonRetryableErrorso Cloudflare does not retry the workflow with a payload it cannot parse. -
Creates a
SideffectStepfaçade — wraps Cloudflare’s nativestepobject with typedstep.do(),step.sleep(),step.sleepUntil(), andstep.waitForEvent()methods that handle payload/result schema decoding for each step. -
Calls the layer’s
runfunction — passes the decoded payload, theWorkflowContext(containingenvandctx), and theSideffectStepfaçade. -
Converts
NonRetryableError— if the layer’srunfunction throws a SideffectNonRetryableError, it is re-thrown as the native CloudflareNonRetryableErrorfromcloudflare:workflowsso the platform stops retrying immediately.