The best way to control Claude Code, Codex and more from any computer or phone

main
md 40 lines 1.62 KB
Rendered Raw
1 ---
2 title: 2.0.0-beta.42 - npm Install Hotfix
3 date: 2026-05-20T23:30:00Z
4 category: release
5 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.
6 ---
7
8 `v2.0.0-beta.42` is a one-fix hotfix for a crash that only
9 reproduced when alchemy was installed from npm:
10
11 ```
12 ReferenceError: Cannot access 'bindWorkerAsyncBindings' before initialization
13 at node_modules/alchemy/src/Cloudflare/Workers/Worker.ts:684:13
14 ```
15
16 `Worker.ts` forms import cycles with `WorkerAsyncBindings.ts` and
17 `WorkerRuntimeContext.ts`, and it passed their exports directly
18 into `Platform(...)` — reading them at module-load time. When Bun
19 enters the cycle from the other side (which happens with the npm
20 package layout, but not in the local workspace), those references
21 are still in their temporal dead zone and the import crashes.
22
23 beta.42 wraps both hook arguments in arrows so they resolve at
24 call time instead of module-load time
25 ([#378](https://github.com/alchemy-run/alchemy/pull/378)):
26
27 ```diff lang="typescript"
28 } = Platform(WorkerTypeId, {
29 - onCreate: bindWorkerAsyncBindings,
30 - createRuntimeContext: makeWorkerRuntimeContext,
31 + onCreate: (resource, props) =>
32 + bindWorkerAsyncBindings(resource as Worker, props),
33 + createRuntimeContext: (id) => makeWorkerRuntimeContext(id),
34 });
35 ```
36
37 ## Where to go next
38
39 - [CHANGELOG](https://github.com/alchemy-run/alchemy/blob/main/CHANGELOG.md#v200-beta42)
40 - [Compare v2.0.0-beta.41 → v2.0.0-beta.42](https://github.com/alchemy-run/alchemy/compare/v2.0.0-beta.41...v2.0.0-beta.42)