The best way to control Claude Code, Codex and more from any computer or phone
title: 2.0.0-beta.42 - npm Install Hotfix date: 2026-05-20T23:30:00Z category: release
excerpt: v2.0.0-beta.42 is a one-fix hotfix for a ReferenceError crash that only reproduced when alchemy was installed from npm — a module-load-order TDZ in the Cloudflare Worker's Platform hooks.
v2.0.0-beta.42 is a one-fix hotfix for a crash that only
reproduced when alchemy was installed from npm:
ReferenceError: Cannot access 'bindWorkerAsyncBindings' before initialization
at node_modules/alchemy/src/Cloudflare/Workers/Worker.ts:684:13
Worker.ts forms import cycles with WorkerAsyncBindings.ts and
WorkerRuntimeContext.ts, and it passed their exports directly
into Platform(...) — reading them at module-load time. When Bun
enters the cycle from the other side (which happens with the npm
package layout, but not in the local workspace), those references
are still in their temporal dead zone and the import crashes.
beta.42 wraps both hook arguments in arrows so they resolve at call time instead of module-load time (#378):
diff lang="typescript"
} = Platform(WorkerTypeId, {
- onCreate: bindWorkerAsyncBindings,
- createRuntimeContext: makeWorkerRuntimeContext,
+ onCreate: (resource, props) =>
+ bindWorkerAsyncBindings(resource as Worker, props),
+ createRuntimeContext: (id) => makeWorkerRuntimeContext(id),
});