feat(cloudflare/workers-for-platforms): dispatch namespace binding + deploy workers into namespaces - #715
Merged
Merged
Conversation
…deploy workers into namespaces Add the `Get` dynamic-dispatch binding and teach the Worker resource to deploy into a dispatch namespace as a user worker. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/5343c81@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/5343c81@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/5343c81 |
…v + InferEnv Passing a DispatchNamespace on a Worker's `env` now emits a native `dispatch_namespace` binding, and `InferEnv` types `env.X` as the runtime `DispatchNamespace`. Adds an async-worker fixture + InferEnv e2e test alongside the Effect-native `Get` one, and documents both binding styles on the resource. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…acement model Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…mespaceScriptSetting Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
DavidJFelix
pushed a commit
to DavidJFelix/alchemy-effect
that referenced
this pull request
Aug 7, 2026
…deploy workers into namespaces (alchemy-run#715)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the Workers for Platforms dynamic-dispatch binding and let a Worker deploy into a dispatch namespace as a "user worker" — no duplicate Worker resource.
Bind a dispatch namespace to a platform Worker
Two interchangeable styles, both emitting the native
dispatch_namespacebinding:Provide
Cloudflare.WorkersForPlatforms.GetBindingon the Worker's runtime layer for the Effect-native path.Worker
namespaceprop — deploy into a namespaceThe provider switches its put/read/delete/settings calls to the
dispatch/namespaces/:ns/scriptsendpoints whennamespaceis set, skips the (inapplicable) subdomain / custom-domain / workers.dev / cron reconciliation and the precreate placeholder, and replaces the Worker if it moves into/out of/between namespaces. Reference the namespace vians.name(an Output) so it resolves and orders correctly.Tests
DispatchBinding.test.tsdeploys a namespace + a user worker in it + two platform workers (Effect-nativeGetand asyncenv/InferEnv), then drives each overHttpClient(forwards by script name, asserts the dispatched response + header pass-through), plus an unknown-script negative case. Verified live: fresh deploy → dispatch round-trip for both styles → destroy.Depends on
distilled patch alchemy-run/distilled#361 (typed errors + a placement-union fix for
getDispatchNamespaceScriptSetting(append the omitted response variant)); the submodule pointer is bumped to it here.🤖 Generated with Claude Code