Skip to content

[miniflare] Forward service binding and tail consumer props across the dev registry#13649

Merged
petebacondarwin merged 1 commit intomainfrom
fix/dev-registry-props-forwarding
Apr 24, 2026
Merged

[miniflare] Forward service binding and tail consumer props across the dev registry#13649
petebacondarwin merged 1 commit intomainfrom
fix/dev-registry-props-forwarding

Conversation

@petebacondarwin
Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin commented Apr 23, 2026

Fixes a bug where service binding and tail consumer props were silently dropped when the target worker was running in a separate local dev instance (via the dev registry).

When Miniflare encounters a service binding or tail consumer pointing at a worker that isn't in the current Miniflare config, it rewrites the binding to redirect through a local dev-registry-proxy worker. Two issues on that path caused props to be lost:

  1. getExternalServiceEntrypoints in packages/miniflare/src/index.ts overwrote the user-supplied props with internal routing metadata ({ service, entrypoint }).
  2. The proxy worker called WorkerdDebugPortClient.getEntrypoint(service, entrypoint) without ever passing the user's props as the optional third argument.

The fix preserves the original props as userProps inside the proxy's routing metadata, and passes them to getEntrypoint(service, entrypoint, userProps). Workerd's debug-port RPC already accepts this argument (see worker-interface.capnpgetEntrypoint @0 (service :Text, entrypoint :Text, props :Frankenvalue)) and populates ctx.props on the callee, so no workerd-side changes are needed.

The same rewrite/drop pattern applies to tail consumers (workerOpts.core.tails), so both are fixed in one pass. Durable Object bindings are not affected because workerd has no props field on DurableObjectNamespaceDesignator; streaming tails aren't rewritten by the dev registry at all today and are out of scope here.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this restores expected behavior to an existing documented feature.

A picture of a cute animal (not mandatory, but encouraged)


Open in Devin Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 23, 2026

🦋 Changeset detected

Latest commit: ad4d60c

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Apr 23, 2026
@workers-devprod workers-devprod requested review from a team and dario-piotrowicz and removed request for a team April 23, 2026 13:44
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Apr 23, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

Changeset Review

File Reviewed: .changeset/fix-dev-registry-service-binding-props.md

Review Summary

All changesets look good

Details

Criterion Status Notes
Version Type patch is appropriate for this bug fix
Changelog Quality Clear description of the bug (props being dropped), explains the fix, includes helpful wrangler.json configuration example
Markdown Headers No h1/h2/h3 headers present
Analytics No analytics changes
Dependabot Not a dependabot changeset
Experimental Features Not an experimental feature

Positive Notes

  • Well-written description explaining both the problem ("props were silently dropped") and the solution
  • Useful code example showing the wrangler.json configuration with props
  • Correctly identifies both affected packages (miniflare and wrangler)
  • Clear explanation of the behavior change for the target worker's entrypoint

ask-bonk[bot]

This comment was marked as resolved.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Apr 23, 2026

Review posted successfully on PR #13649. The implementation is solid — the only finding is that the changeset unnecessarily includes "wrangler": patch when no wrangler files were changed. Changesets will handle the transitive wrangler bump automatically since it depends on miniflare.

github run

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@petebacondarwin petebacondarwin force-pushed the fix/dev-registry-props-forwarding branch from d41cb7c to a4778bd Compare April 23, 2026 14:04
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 23, 2026

create-cloudflare

npm i https://pkg.pr.new/cloudflare/workers-sdk/create-cloudflare@13649

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/kv-asset-handler@13649

miniflare

npm i https://pkg.pr.new/cloudflare/workers-sdk/miniflare@13649

@cloudflare/pages-shared

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/pages-shared@13649

@cloudflare/unenv-preset

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/unenv-preset@13649

@cloudflare/vite-plugin

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/vite-plugin@13649

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/vitest-pool-workers@13649

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/workers-editor-shared@13649

@cloudflare/workers-utils

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/workers-utils@13649

wrangler

npm i https://pkg.pr.new/cloudflare/workers-sdk/wrangler@13649

commit: ad4d60c

@petebacondarwin petebacondarwin force-pushed the fix/dev-registry-props-forwarding branch 4 times, most recently from 78f11c7 to e7cd34e Compare April 24, 2026 08:21
…e dev registry

When a service binding or tail consumer configured with `props` targeted a worker
running in a separate miniflare instance via the dev registry, the `props` were
silently dropped and the remote entrypoint saw an empty `ctx.props`. The rewrite
that redirects such bindings to the local dev-registry proxy worker overwrote the
user-supplied props with internal routing metadata, and the proxy never forwarded
props to the remote when calling `getEntrypoint` over the workerd debug port.

Preserve the original props as `userProps` inside the proxy's routing metadata,
then pass them through as the third argument to `WorkerdDebugPortClient.getEntrypoint`,
which workerd already accepts and surfaces as `ctx.props` on the callee.
@petebacondarwin petebacondarwin force-pushed the fix/dev-registry-props-forwarding branch from e7cd34e to ad4d60c Compare April 24, 2026 10:26
@dario-piotrowicz
Copy link
Copy Markdown
Member

@petebacondarwin
Copy link
Copy Markdown
Contributor Author

This seems like a legitimate issue: https://github.com/cloudflare/workers-sdk/actions/runs/24884767213/job/72871751377?pr=13649#step:7:694 👀

I ran it again and it passed, so I think it was a flake??

@dario-piotrowicz
Copy link
Copy Markdown
Member

This seems like a legitimate issue: https://github.com/cloudflare/workers-sdk/actions/runs/24884767213/job/72871751377?pr=13649#step:7:694 👀

I ran it again and it passed, so I think it was a flake??

oh... it failed 2/3 times in a row with the same error message that mentioned the dev registry, so it looked legitimate to me 😮

Copy link
Copy Markdown
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🙂

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Apr 24, 2026
@petebacondarwin petebacondarwin merged commit ae8eae3 into main Apr 24, 2026
80 of 86 checks passed
@petebacondarwin petebacondarwin deleted the fix/dev-registry-props-forwarding branch April 24, 2026 14:26
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Apr 24, 2026

// Read the captured ctx.props back via the remote's default fetch.
const res = await remote.dispatchFetch("http://placeholder");
expect(res.status).toBe(200);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if res.status is not 200, we won't read the response body with res.json on the next line, which means we will fail when MINIFLARE_ASSERT_BODIES_CONSUMED=true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await vi.waitFor(
async () => {
const res = await local.dispatchFetch("http://placeholder");
expect(res.status).toBe(200);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vaishnav-mk pushed a commit to vaishnav-mk/workers-sdk that referenced this pull request Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants