Skip to content

[Workers for Platforms] Document dynamic dispatch props - #33423

Merged
dinasaur404 merged 1 commit into
productionfrom
docs/wfp-dynamic-dispatch-props
Sep 16, 2026
Merged

dinasaur404 merged 1 commit into
productionfrom
docs/wfp-dynamic-dispatch-props

Conversation

@dinasaur404

Copy link
Copy Markdown
Contributor

Summary

Documents how a Workers for Platforms dispatch Worker can pass per-request data and scoped RPC capabilities to user Workers.

  • Adds dispatch Worker and user Worker examples for plain data and capabilities passed through props.
  • Clarifies the request-scoped lifetime of RPC capabilities and how Outbound Worker parameters differ.
  • Links request-scoped capabilities from the bindings page and removes the duplicated custom limits example.

Documentation checklist

@github-actions

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/cloudflare-for-platforms/workers-for-platforms/ @dinasaur404, @irvinebroque, @cloudflare/deploy-config, @cloudflare/product-owners

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://docs-wfp-dynamic-dispatch-props.previews.developers.cloudflare.com (commit 4faeffc)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://f88c682b.previews.developers.cloudflare.com 4faeffc 2026-09-14T18:36:05.017Z Visit the dashboard ↗


To create a capability, export a `WorkerEntrypoint` class from your dispatch Worker. The [`ctx.exports`](/workers/runtime-apis/context/#exports) object lets the dispatch Worker create an RPC stub for that exported class, which it can then pass to the user Worker.

The following example shows this pattern. The dispatch Worker uses a site ID and visitor ID to create a `Connector` capability. It passes the capability to the user Worker through `props`, without passing those IDs as separate data values. The user Worker can then call the methods exposed by `Connector`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example might read more easily if it followed the same example as above - ie one example showing how to do authorization by passing data (user-id + permissions), and one by passing a capability (user-id + Authorizer). The capability could be an Authorizer class that has a method to authorize some query without leaking details about the data behind the authorization policy.

Cloudflare.Env,
ConnectorProps
> {
async invoke(): Promise<string> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth a passing reference to https://developers.cloudflare.com/workers/runtime-apis/rpc/#all-calls-are-asynchronous ? Or maybe just having the RPC link above to https://developers.cloudflare.com/workers/runtime-apis/rpc/#_top instead of jumping to the structured-clonable bit?

Having async on a method that is clearly sync can be otherwise confusing - it's a common surprise for RPC users.

@dinasaur404
dinasaur404 marked this pull request as ready for review September 16, 2026 00:06
@dinasaur404
dinasaur404 requested review from a team and irvinebroque as code owners September 16, 2026 00:06
@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review

⚠️ 1 warning found in commit 4faeffc.

👉 Fix in your agent 👈
Fix the following review findings in PR #33423 (https://github.com/cloudflare/cloudflare-docs/pull/33423).

Before making changes, review each finding and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g. the fix requires disproportionate effort for minimal benefit,
  or the finding is factually incorrect), explain why
- If you need clarification before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

After triaging, follow this order:
1. Post a comment on this PR for any findings you are skipping, with the finding ID and your reasoning.
2. Then commit the fixes for the legitimate findings.

The comment must come before the commit — the bot reads PR comments when a new
push triggers a review, so skip comments posted after the push will be missed.

---

## Code Review

### Warnings (1)

#### CR-bf18ec3014aa · Missing required compatibility flag
- **File:** `src/content/docs/cloudflare-for-platforms/workers-for-platforms/configuration/dynamic-dispatch.mdx` line 115
- **Issue:** The new "Give access to specific platform functions" section teaches `ctx.exports.Connector({ props })` (used at line 144) without mentioning that the `ctx.exports` API requires the `enable_ctx_exports` compatibility flag. The linked reference page (`/workers/runtime-apis/context/#exports`) explicitly states this requirement in a "Compatibility flag required" note. Users copying this example with a compatibility date before 2025-11-17 will get an error (`ctx.exports` unavailable) with no hint in this doc as to why.
- **Fix:** Add a note in this section that `enable_ctx_exports` must be added to `compatibility_flags` (or that it is enabled by default only for compatibility dates on/after 2025-11-17), mirroring the note on the Context API reference page.

Code Review

This code review is in beta and may not always be helpful — use your judgment.

Warnings (1)
File Issue
cloudflare-for-platforms/workers-for-platforms/configuration/dynamic-dispatch.mdx line 115 Missing required compatibility flag — The new "Give access to specific platform functions" section teaches ctx.exports.Connector({ props }) (used at line 144) without mentioning that the ctx.exports API requires the enable_ctx_exports compatibility flag. The linked reference page (/workers/runtime-apis/context/#exports) explicitly states this requirement in a "Compatibility flag required" note. Users copying this example with a compatibility date before 2025-11-17 will get an error (ctx.exports unavailable) with no hint in this doc as to why. Fix: Add a note in this section that enable_ctx_exports must be added to compatibility_flags (or that it is enabled by default only for compatibility dates on/after 2025-11-17), mirroring the note on the Context API reference page.

Conventions

No convention issues found.

Style Guide Review

No style-guide issues found.

Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.
/disable-auto-review Stops automatic reviews from triggering on future pushes to this PR. Codeowners can still run /review or /full-review manually.
/rebase Rebases the PR branch against production. On conflict, attempts to resolve automatically using AI. Stops with an explanation if confidence is not high enough.

@dinasaur404
dinasaur404 merged commit 52dfce1 into production Sep 16, 2026
22 checks passed
@dinasaur404
dinasaur404 deleted the docs/wfp-dynamic-dispatch-props branch September 16, 2026 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants