chadtmiller.com/pds.js
An atproto PDS in JavaScript, for Cloudflare Workers and Node
0
0
A Cloudflare PDS reaches Workers on its own account through service bindings
Merged Approved
This adds createBoundFetch, which sends the hosts named in PDS_FETCH_BINDINGS to their service bindings and everything else to the network. The lexicon resolver and the DID resolver now use it. I found nothing that needs to change.
- Input handling: it copes with
Request, string andURLinputs. - Bad config: malformed pairs, missing bindings and non-service values are skipped without throwing.
- Matching: host matching is lowercased on both sides, and
URL.hostnameignores the port. - Tests, docs, changeset: the tests cover the main paths, and the docs and changeset are present.
I did not run the code or the checks. The PR body says the failure to resolve was not observed directly, so the deploy is the real test.
All checks have passed
6 passed
Merged as 1fc7abc
What changes
The Cloudflare adapter reads
PDS_FETCH_BINDINGS, comma-separatedhost=BINDINGpairs. The lexicon resolver and the DID resolver fetch a named host through that service binding, and everything else over the network as before (createBoundFetchinpackages/cloudflare/src/index.js). A pair whose binding is missing, or is not a service, is ignored.docs/deploy-cloudflare.mdhas a new section, "Other Workers on your account", with an example.Why
A Worker cannot fetch another Worker's
workers.devaddress on the same Cloudflare account. A PDS on such an account therefore can't resolve lexicons or DIDs published on a sibling Worker's PDS, and the resolver reads each one as not published. pds.js now writes a space type's declared collections into a barespace:scope. Thepdsworker is meant to resolvedev.knotless.spacefromknotless-lexicons-pds.chad-53c.workers.devon the same account, but tokens it issued after that change still carried no collections.How it was checked
packages/cloudflare/test/fetch-bindings.test.js:Request.emailer.test.jspass.tsc(both projects) and biome are clean. The full gate is left to CI.Shortcomings
The same-account block is Cloudflare's documented behavior (error 1042), but this PDS's failure to resolve was not seen directly. The resolver records nothing when a lookup fails. The deploy that adds the binding is the test: a login should then be granted the collections.
🤖 Generated with Claude Code