Skip to content

fix(cloudflare/workers): provide workerd-safe runtime services - #1403

Open
harrysolovay wants to merge 1 commit into
alchemy-run:mainfrom
harrysolovay:fix/worker-runtime-services
Open

fix(cloudflare/workers): provide workerd-safe runtime services#1403
harrysolovay wants to merge 1 commit into
alchemy-run:mainfrom
harrysolovay:fix/worker-runtime-services

Conversation

@harrysolovay

Copy link
Copy Markdown

Summary

  • replace the aggregate NodeServices.layer with the specific Node platform services supported by workerd, excluding NodeTerminal
  • compose NodeChildProcessSpawner.layer with FileSystem and Path via Layer.provideMerge so its requirements are satisfied
  • provide the runtime Alchemy.Stage service from stack.stage

Background

NodeServices.layer initializes NodeTerminal, which calls process.stdin.once(...). Cloudflare's Node compatibility shim does not implement .once(), so Worker startup failed with t.once is not a function before the user handler ran.

Simply merging the remaining platform layers as siblings is insufficient because Layer.mergeAll does not use sibling outputs to satisfy sibling requirements. In particular, NodeChildProcessSpawner.layer requires FileSystem and Path, which led to Service not found: effect/platform/FileSystem. This change retains dependency-aware composition while omitting the unsupported terminal service.

Verification

  • commit hook formatting passed
  • further checks skipped as requested
  • pnpm install --frozen-lockfile reached the repository prepare step, which could not find the uninitialized distilled/packages/cloudflare submodule in the fresh clone

@sam-goodwin

Copy link
Copy Markdown
Contributor

Can you provide a reproduction? I am confused about this error.

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.

2 participants