Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alchemy Queue binding service-binding reproduction

Minimal reproduction for a local-development issue observed with Alchemy 2.0.0-beta.72.

The repository starts from Alchemy's cloudflare-tanstack example. The first commit is the working baseline: an Effect-native backend Worker and a TanStack Start Cloudflare.Website.Vite Worker communicate through an Alchemy service binding.

The second commit adds one Cloudflare Queue and the backend's Cloudflare.Queues.WriteQueueBinding. With that change, the backend remains reachable directly, but the Website's service binding returns Alchemy's local proxy error:

503 Worker "<backend-name>" not found. Make sure the worker is running locally.

This repository contains no application credentials, .env files, Cloudflare account identifiers, API keys, authentication state, or production code.

Versions

The reproduction was observed with:

  • Alchemy 2.0.0-beta.72
  • Effect 4.0.0-rc.108
  • workerd 1.20260704.1 (installed by Alchemy)
  • Node.js >=22.18.0
  • pnpm 10.33.2

Repository history

The commits intentionally separate the control and failing case:

d92baff chore: establish working Alchemy baseline
e68c60d test: reproduce queue binding service failure

To inspect the baseline:

git checkout d92baff

To inspect the failing case:

git checkout e68c60d

Install

pnpm install
pnpm check

No credentials or .env file are required for the local reproduction.

Run the baseline

git checkout d92baff
pnpm exec alchemy dev --stage queue-binding-baseline

The dedicated ports are:

  • backend: http://localhost:14337
  • Website: http://localhost:15173

In another terminal:

curl -i 'http://localhost:14337/?key=missing'
curl -i 'http://localhost:15173/api/hello?via=fetch&key=missing'

Both requests reach the backend and return its expected 404 Not found response.

Run the failing Queue case

git checkout e68c60d
pnpm exec alchemy dev --stage queue-binding-failure

Run the same requests:

curl -i 'http://localhost:14337/?key=missing'
curl -i 'http://localhost:15173/api/hello?via=fetch&key=missing'

Observed result:

Direct backend: 404 Not found
Website -> backend: 503 Worker "<backend-name>" not found

The Alchemy stack reports both Workers as ready. The direct backend request continues to work, while the Website's env.BACKEND.fetch(...) call cannot resolve the backend target in the local service-binding proxy.

Minimal code difference

The failing commit adds only:

export const Queue = Cloudflare.Queues.Queue("Queue")

and to the existing backend Worker:

const queueResource = yield* Queue
const queue = yield* Cloudflare.Queues.WriteQueue(queueResource)

with:

Cloudflare.Queues.WriteQueueBinding

provided alongside the existing R2 binding.

The queue client is not used by the tested HTTP route. Its initialization and binding registration are sufficient to reproduce the service-binding failure.

Suspected upstream path

WriteQueueBinding
  -> host.bind(...)
  -> local Worker binding metadata/materialization
  -> local registry/service-binding update
  -> Website env.BACKEND target map

The Queue resource alone does not reproduce the issue. The baseline's existing Website-to-backend service binding also works. The smallest failing change is the backend's Queue producer binding initialization.

Relevant files

  • alchemy.run.ts — backend, Website, R2 Bucket, and Queue resources
  • src/backend.ts — Effect-native backend and binding layers
  • src/routes/api.hello.ts — Website route forwarding to env.BACKEND
  • src/env.ts — Website Worker environment proxy
  • vite.config.ts — TanStack Start Vite configuration

About

Minimal reproduction for Alchemy Cloudflare Queue WriteQueueBinding local service-binding failure

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages