Skip to content

test(cloudflare/containers): deploy the #1321 container-binding shape - #1325

Merged
sam-goodwin merged 1 commit into
mainfrom
claude/unit-test-fixture-repro-2a3aea
Aug 23, 2026
Merged

sam-goodwin merged 1 commit into
mainfrom
claude/unit-test-fixture-repro-2a3aea

Conversation

@sam-goodwin

@sam-goodwin sam-goodwin commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1321

#1321 is the #953 symptom again — getContainer(env.X, …) dying with idFromName is not a function for a Container bound on an async Worker's env. The fix landed in #1271 (merged after the issue was filed; the reporter was on beta.74). This PR changes no behaviour; it pins the exact reported shape with a deployed fixture.

// fixtures/inferred/stack.ts — the "Bind on an async Worker" shape from the
// Containers guide: env key, logical id and DO class are all one name.
export const InferredClassWorker = Cloudflare.Worker("InferredClassWorker", {
  main: path.resolve(import.meta.dirname, "worker.ts"),
  env: { Probe: Cloudflare.Container<Probe>("Probe", { image: "…" }) },
});

The existing fixtures/async case names a class that differs from the env key. With className omitted there is nothing left to tell the Worker's durable_object_namespace binding and its containers metadata apart, so this is the shape that collapsed under one sid and lost the namespace binding.

Deployed in the dev/live matrix of Container.test.ts and driven over HTTP: /binding asserts env.Probe is a namespace, /hello round-trips Worker → DO class → container. Reverting the #1271 hunk fails it on a real deploy with the reporter's exact payload:

expected { kind: "{\"_id\":\"Effect\",\"op\":\"alchemy/EffectClass\"}" }
to equal { kind: "durable_object_namespace" }

Not addressed

The issue's "Related friction" note — a deploy silently adopting the Worker as external with env: {} when main transitively imports a module Node can't load — is not reproduced. Nothing imports main under Node at plan time, and recovery-by-renaming points at a state/adoption interaction; it needs the reporter's state export to chase.

@alchemy-version-bot

alchemy-version-bot Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

Alchemy

alchemy

bun add https://pkg.ing/alchemy/e94e7f7

@alchemy.run/better-auth

bun add https://pkg.ing/@alchemy.run/better-auth/e94e7f7

@alchemy.run/cloudflare-runtime

bun add https://pkg.ing/@alchemy.run/cloudflare-runtime/e94e7f7

@alchemy.run/frontend-frameworks

bun add https://pkg.ing/@alchemy.run/frontend-frameworks/e94e7f7

@alchemy.run/node-utils

bun add https://pkg.ing/@alchemy.run/node-utils/e94e7f7

@alchemy.run/pr-package

bun add https://pkg.ing/@alchemy.run/pr-package/e94e7f7

@alchemy.run/floci

bun add https://pkg.ing/@alchemy.run/floci/e94e7f7

Distilled

@distilled.cloud/core

bun add https://pkg.ing/@distilled.cloud/core/dd2a322

@distilled.cloud/aws

bun add https://pkg.ing/@distilled.cloud/aws/dd2a322

@distilled.cloud/axiom

bun add https://pkg.ing/@distilled.cloud/axiom/dd2a322

@distilled.cloud/cloudflare

bun add https://pkg.ing/@distilled.cloud/cloudflare/dd2a322

@distilled.cloud/hetzner

bun add https://pkg.ing/@distilled.cloud/hetzner/dd2a322

@distilled.cloud/neon

bun add https://pkg.ing/@distilled.cloud/neon/dd2a322

@distilled.cloud/planetscale

bun add https://pkg.ing/@distilled.cloud/planetscale/dd2a322

@sam-goodwin sam-goodwin changed the title fix(cloudflare/workers): fail the deploy when an env entry lost its binding test(cloudflare/containers): pin the async container env binding offline Aug 23, 2026
Issue #1321 reported the #953 symptom — `getContainer(env.X)` dying with
`idFromName is not a function` — for a Container bound on an async Worker's
`env` in the shape the Containers guide documents: `className` omitted, so
the env key, the Container's logical id and the DO class share one name.
The fix landed in #1271; this pins that exact shape with a deployed fixture,
driven over HTTP in both dev and live.

Without #1271 the deployed Worker reports env.Probe as
`{"_id":"Effect","op":"alchemy/EffectClass"}`; with it, a namespace that
round-trips Worker -> DO class -> container.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sam-goodwin
sam-goodwin force-pushed the claude/unit-test-fixture-repro-2a3aea branch from bb9ab05 to e94e7f7 Compare August 23, 2026 10:27
@sam-goodwin sam-goodwin changed the title test(cloudflare/containers): pin the async container env binding offline test(cloudflare/containers): deploy the #1321 container-binding shape Aug 23, 2026
@sam-goodwin
sam-goodwin merged commit 24cc23a into main Aug 23, 2026
7 checks passed
@sam-goodwin
sam-goodwin deleted the claude/unit-test-fixture-repro-2a3aea branch August 23, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Async Worker container binding delivers a non-namespace env value (idFromName is not a function)

1 participant