Skip to content

fix: Support dev.plugin on typed services bindings#14269

Merged
mattjohnsonpint merged 1 commit into
mainfrom
mjp/dev-services-bindings
Jun 17, 2026
Merged

fix: Support dev.plugin on typed services bindings#14269
mattjohnsonpint merged 1 commit into
mainfrom
mjp/dev-services-bindings

Conversation

@mattjohnsonpint

@mattjohnsonpint mattjohnsonpint commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Wrangler previously only honored dev.plugin on unsafe.bindings entries, so users authoring a service binding via services[] could not wire it to a local Miniflare plugin during wrangler dev — they had to fall back to unsafe.bindings and accept a warning such as:

The binding type "service" is directly supported by wrangler.
Consider migrating this unsafe binding to a format for 'service' bindings that is supported by wrangler for optimal support.

The typed services[] form now accepts the same dev: { plugin, options? } shape, routes the binding through Miniflare's external-plugin pathway in wrangler dev, and strips the field at deploy time. Validation rejects malformed dev shapes.

Needed as a prerequisite to fixing https://jira.cfdata.org/browse/CC-7944


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation

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


Open in Devin Review

@changeset-bot

changeset-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a747dab

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

This PR includes changesets to release 7 packages
Name Type
wrangler Patch
@cloudflare/workers-utils Patch
@cloudflare/deploy-helpers Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch
@cloudflare/cli-shared-helpers Patch
@cloudflare/workers-auth Patch

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 Jun 12, 2026
@workers-devprod workers-devprod requested review from a team and penalosa and removed request for a team June 12, 2026 05:11
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/typed-service-binding-dev-plugin.md: [@cloudflare/wrangler]
  • packages/deploy-helpers/src/deploy/helpers/print-bindings.ts: [@cloudflare/wrangler]
  • packages/workers-utils/src/config/validation.ts: [@cloudflare/wrangler]
  • packages/workers-utils/src/worker.ts: [@cloudflare/wrangler]
  • packages/workers-utils/tests/config/validation/normalize-and-validate-config.test.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/tests/deploy/bindings.test.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/tests/unstable-get-miniflare-worker-options.test.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/dev/miniflare/index.ts: [@cloudflare/wrangler]

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@ask-bonk

ask-bonk Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

There's no validation that remote and dev are mutually exclusive, but that's a minor concern since the dev path takes precedence and remote is only relevant for deploy/remote mode anyway. Not a blocking issue.

I've completed a thorough review. The change is well-structured, well-tested, and the logic is correct:

  • services loop correctly skips dev-plugin services (line 614-618)
  • The typed-service plugin path correctly strips dev, remote, props and keeps production options
  • Validation is thorough (actually more thorough than the existing unsafe path)
  • Deploy-time stripping happens implicitly via the explicit field selection in the upload form, verified by test
  • print-bindings.ts shows the correct local mode

I considered potential issues (type prefix handling, options serializability, remote+dev conflict, unknown property leakage) and none are actionable bugs. The remote/dev mutual-exclusion is a minor edge case but the precedence is sensible and not a correctness bug.

LGTM

github run

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Jun 12, 2026

Copy link
Copy Markdown
create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14269

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14269

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14269

miniflare

npm i https://pkg.pr.new/miniflare@14269

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14269

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14269

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14269

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14269

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

npm i https://pkg.pr.new/wrangler@14269

commit: a747dab

@petebacondarwin petebacondarwin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given that this is an internal only feature, hence no public documentation, I think we should name it something like unstable_dev to indicate that it is not to be relied upon.

Comment thread .changeset/typed-service-binding-dev-plugin.md Outdated
Comment thread packages/deploy-helpers/src/deploy/helpers/print-bindings.ts Outdated
@github-project-automation github-project-automation Bot moved this from Untriaged to In Review in workers-sdk Jun 16, 2026
@petebacondarwin petebacondarwin removed the request for review from penalosa June 16, 2026 07:07
@mattjohnsonpint

Copy link
Copy Markdown
Contributor Author

Given that this is an internal only feature, hence no public documentation, I think we should name it something like unstable_dev to indicate that it is not to be relied upon.

Hmm... it sits on CfService right next to cross_account_grant which is also internal/undocumented if I understand correctly. It might feel strange to have one labeled unstable and not the other. But it's easy enough to change. LMK what you would like here. Thanks.

@mattjohnsonpint mattjohnsonpint force-pushed the mjp/dev-services-bindings branch from 056b55d to 168aa4c Compare June 16, 2026 17:46
devin-ai-integration[bot]

This comment was marked as resolved.

@petebacondarwin petebacondarwin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OK. Thanks for iterating. I agree we may as well leave the naming as it is.
I left one nit about the structure of the code in miniflare/index.ts, but we could always do a follow up to tidy that up if you want.

Comment thread packages/wrangler/src/dev/miniflare/index.ts Outdated
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

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 In Review to Approved in workers-sdk Jun 17, 2026
Wrangler only honored dev.plugin on unsafe.bindings entries, so users
authoring a service binding via services[] could not wire it to a local
Miniflare plugin during wrangler dev — they had to fall back to
unsafe.bindings and accept a 'directly supported by wrangler' warning. The
typed services[] form now accepts the same dev: { plugin, options? }
shape, routes the binding through Miniflare's external-plugin pathway in
wrangler dev, and strips the field at deploy time. Validation rejects
malformed dev shapes.
@mattjohnsonpint mattjohnsonpint force-pushed the mjp/dev-services-bindings branch from 3035a72 to a747dab Compare June 17, 2026 17:25
@mattjohnsonpint mattjohnsonpint merged commit 5dfb788 into main Jun 17, 2026
60 checks passed
@mattjohnsonpint mattjohnsonpint deleted the mjp/dev-services-bindings branch June 17, 2026 19:50
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Jun 17, 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.

3 participants