support using containers with ctx.exports#11512
Merged
emily-shen merged 8 commits intomainfrom Dec 10, 2025
Merged
Conversation
🦋 Changeset detectedLatest commit: 1743847 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
emily-shen
commented
Dec 4, 2025
Contributor
Author
There was a problem hiding this comment.
All of this code is in the cloudchamber folder but isn't actually used by any cloudchamber paths, so i've moved these functions into the containers folder. (under build.ts and deploy.ts)
emily-shen
commented
Dec 4, 2025
| versionId, | ||
| accountId, | ||
| scriptName, | ||
| dryRun: props.dryRun ?? false, |
Contributor
Author
There was a problem hiding this comment.
not strictly related to this PR but dry run will have already exited by the point this is called so this was unnecessary
350145c to
52ead14
Compare
gabivlj
approved these changes
Dec 4, 2025
KianNH
approved these changes
Dec 4, 2025
gpanders
approved these changes
Dec 4, 2025
rushilmehra
approved these changes
Dec 4, 2025
38d4bd9 to
52cacc5
Compare
petebacondarwin
approved these changes
Dec 5, 2025
Contributor
petebacondarwin
left a comment
There was a problem hiding this comment.
LGTM with a few questions
093e846 to
9765c8d
Compare
9765c8d to
2fc3545
Compare
Merged
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.
Fixes CC-6386.
The containers control plane needs a DO namespace id (sort of*) when creating a container app in order to link the container app and DO. This is helpfully returned by EWC when the script has a binding to a DO, but not when the DO is simply exported from the script and unbound. For now, we have to list and filter all DO namespace ids, which is not ideal, but there is a PR in flight that should enable search params on the DO list endpoint.
*The container create API can actually accept a script and class name instead, and this is what (future) direct API users would be using.
However, wrangler is in an awkward place because of how we automatically provision containers. Wrangler deploy needs to know whether a particular container + durable object combination already exists, and thus whether we should create a new container app, modify an existing one, or error because you've accidentally tried to reuse the name of an existing container app.
So wrangler will have to get the container's DO's namespace id to make sure it hasn't changed, and at that point we might as well just pass that to the container create API.
(possibly this is something that should be solved EWC side but i think we could follow up with that if we want?)