Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Oct 8, 2025

Fixes #8970.

This PR fixes self-bindings (service bindings where a worker binds to itself) incorrectly showing as [not connected] in wrangler dev.

The Problem:
When a worker has a service binding that references itself (same service name as the worker name), the connection status check in print-bindings.ts would look up the service in the dev registry to determine if it's connected. For self-bindings, this could show as disconnected during startup or in cases where the worker hasn't registered itself yet.

The Solution:

  • Detect self-bindings by comparing service === context.name
  • For self-bindings, immediately mark as [connected] since a worker is inherently connected to itself
  • Preserve existing registry-based logic for external service bindings

Testing:

  • Added test case covering both self-bindings without entrypoints (SELF) and with named entrypoints (NAMED)
  • Manually verified with fixtures/workers-with-assets where the NAMED binding now correctly shows as [connected]

Example Before/After:

// Before
env.NAMED (worker-with-assets#NamedEntrypoint)  Worker  local [not connected]

// After  
env.NAMED (worker-with-assets#NamedEntrypoint)  Worker  local [connected]

Link to Devin run: https://app.devin.ai/sessions/70aa50c3e5164f23a2c0c8efecd919af
Requested by: smacleod@cloudflare.com


  • Tests
    • Tests included
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: This is a bug fix for existing functionality with no API changes
  • Wrangler V3 Backport

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@changeset-bot
Copy link

changeset-bot bot commented Oct 8, 2025

🦋 Changeset detected

Latest commit: 7230dfd

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 8, 2025

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

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

commit: 7230dfd

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Oct 13, 2025
@emily-shen emily-shen marked this pull request as ready for review October 27, 2025 10:53
@emily-shen emily-shen requested a review from a team as a code owner October 27, 2025 10:53
devin-ai-integration bot and others added 2 commits October 27, 2025 11:29
Fixes #8970

Self-bindings (service bindings where a worker binds to itself) were
incorrectly showing as [not connected] in wrangler dev. This change
detects self-bindings by comparing the service name to the worker name
and always marks them as connected, since a worker is inherently
connected to itself.

- Modified print-bindings.ts to check for self-bindings before registry lookup
- Added test for self-bindings showing as [connected]
- Manually verified with workers-with-assets fixture

Co-Authored-By: smacleod@cloudflare.com <smacleod@cloudflare.com>
The table column widths are dynamically calculated based on content
length. The self-bindings test has longer binding names than other
service binding tests, which causes wider column spacing in the output.
Updated the snapshot to match the actual table formatting.

Co-Authored-By: smacleod@cloudflare.com <smacleod@cloudflare.com>
@emily-shen emily-shen force-pushed the devin/1759883696-fix-self-binding-connection-status branch from 79e025a to 7230dfd Compare October 27, 2025 11:29
@github-actions
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 devin/1759883696-fix-self-binding-connection-status might be a good starting point.

Notes:

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

@emily-shen emily-shen added the skip-v3-pr Skip validation of presence of a v3 backport PR label Oct 27, 2025
@emily-shen emily-shen merged commit dbe51c1 into main Oct 27, 2025
40 of 42 checks passed
@emily-shen emily-shen deleted the devin/1759883696-fix-self-binding-connection-status branch October 27, 2025 14:31
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Oct 27, 2025
@workers-devprod workers-devprod added the contribution [Holopin] Recognizes an open-source contribution, big or small label Oct 27, 2025
@holopin-bot
Copy link

holopin-bot bot commented Oct 27, 2025

Congratulations @devin-ai-integration[bot], the maintainer of this repository has issued you a holobyte! Here it is: https://holopin.io/holobyte/cmh98kx1800a6l8042nvrptz6

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account.
Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution [Holopin] Recognizes an open-source contribution, big or small skip-v3-pr Skip validation of presence of a v3 backport PR

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

self bindings are logged as [not connected] in wrangler dev

3 participants