Skip to content

Conversation

efalcao
Copy link
Contributor

@efalcao efalcao commented Sep 11, 2025

Implements WVPC-42.

Extend services bindings to support VPC Services.

e.g. "services": [{ "binding": "MYAPI", "service_id": "0199295b-b3ac-7760-8246-bca40877b3e9" }]

I am pretty confident with the deploy and types, but less so with wrangler dev and its various modes - I will need to dig in more but wanted to get this initially reviewed. Also because services is now a union (either a service or a service_id) there is some added complexity here that probably needs improving.

Docs PR to follow

  • Tests
    • Tests included
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because:
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because: not a v3 feature

e.g. `"services": [{ "binding": "MYAPI", "service_id": "0199295b-b3ac-7760-8246-bca40877b3e9" }]`
@efalcao efalcao requested review from a team as code owners September 11, 2025 20:51
Copy link

changeset-bot bot commented Sep 11, 2025

🦋 Changeset detected

Latest commit: 524d2ba

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

This PR includes changesets to release 3 packages
Name Type
wrangler Minor
@cloudflare/vite-plugin Major
@cloudflare/vitest-pool-workers 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

Copy link
Contributor

Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the v3-maintenance branch with your changes. Thank you for helping us keep Wrangler v3 supported!

Depending on your changes, running git rebase --onto v3-maintenance main efalcao/wvpc-binding might be a good starting point.

Notes:

  • your PR branch should be named v3-backport-10628
  • add the skip-v3-pr label to the current PR to stop this workflow from failing

Copy link

pkg-pr-new bot commented Sep 11, 2025

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

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

commit: 524d2ba

@@ -891,29 +891,46 @@ export interface EnvironmentNonInheritable {
* @nonInheritable
*/
services:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a pretty unusual way to add a new binding. Usually there'd be a new top level key vpcs which had these VPC services under it. Is there a particular reason this needs to be under services? I think it's probably going to cause a fair amount of user confusion, and will make the implementation more complex

service_id: binding.service_id,
};
} else {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// eslint-disable-next-line @typescript-eslint/no-explicit-any

if ("service_id" in serviceBinding && serviceBinding.service_id) {
metadataBindings.push({
name: serviceBinding.binding,
type: "connectivity_service_binding",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a different binding type to service, and so should really be a different config property

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, it's a little odd to include a _binding suffix in the binding type—I don't think most others do it like that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Untriaged
Development

Successfully merging this pull request may close these issues.

2 participants