Skip to content

Conversation

devin-ai-integration[bot]
Copy link
Contributor

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: [email protected]


  • 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
    • Wrangler PR:
    • Not necessary because:

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: [email protected] <[email protected]>
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

Copy link

changeset-bot bot commented Oct 8, 2025

🦋 Changeset detected

Latest commit: 79e025a

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

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: 79e025a

devin-ai-integration bot and others added 2 commits October 8, 2025 01:27
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: [email protected] <[email protected]>
Prettier auto-fixed indentation issues that were causing the
'Checks' CI job to fail. The code logic remains unchanged.

Co-Authored-By: [email protected] <[email protected]>
@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

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

1 participant