Skip to content

Fix ctx.id.name for Durable Objects to match production.#4351

Merged
kentonv merged 1 commit intomainfrom
kenton/fix-ctx-id-name
Jun 18, 2025
Merged

Fix ctx.id.name for Durable Objects to match production.#4351
kentonv merged 1 commit intomainfrom
kenton/fix-ctx-id-name

Conversation

@kentonv
Copy link
Member

@kentonv kentonv commented Jun 16, 2025

In prdouction, ctx.id.name is not available. We wish it were, but there are reasons why it's not easy to do. See #2240

A recent refactoring of workerd accidentally made ctx.id.name available in local testing. This was not intended, as it doesn't match production. This commit removes the name, to match production behavior.

@kentonv kentonv requested a review from MellowYarker June 16, 2025 21:05
@kentonv kentonv requested review from a team as code owners June 16, 2025 21:05
In prdouction, ctx.id.name is not available. We wish it were, but there are reasons why it's not easy to do. See #2240

A recent refactoring of workerd accidentally made `ctx.id.name` available in local testing. This was not intended, as it doesn't match production. This commit removes the name, to match production behavior.
@kentonv kentonv force-pushed the kenton/fix-ctx-id-name branch from f0c3a49 to 862e9d6 Compare June 18, 2025 13:39
@kentonv kentonv merged commit 398c1a0 into main Jun 18, 2025
20 checks passed
@kentonv kentonv deleted the kenton/fix-ctx-id-name branch June 18, 2025 14:24
lukevalenta added a commit to cloudflare/azul that referenced this pull request Jul 10, 2025
Unfortunately, we can't use ctx.id.name to find a Durable Object's name within the DO itself (this previously worked only for local testing, but has been removed: cloudflare/workerd#4351). Instead, we can iterate over all possible names for the durable object based on the app configuration until we find the correct one.

Also, clean up some clippy lint complaints.
lukevalenta added a commit to cloudflare/azul that referenced this pull request Jul 10, 2025
Unfortunately, we can't use ctx.id.name to find a Durable Object's name within the DO itself (this previously worked only for local testing, but has been removed: cloudflare/workerd#4351). Instead, we can iterate over all possible names for the durable object based on the app configuration until we find the correct one.

Also, clean up some clippy lint complaints.
lukevalenta added a commit to cloudflare/azul that referenced this pull request Jul 10, 2025
Unfortunately, we can't use ctx.id.name to find a Durable Object's name within the DO itself (this previously worked only for local testing, but has been removed: cloudflare/workerd#4351). Instead, we can iterate over all possible names for the durable object based on the app configuration until we find the correct one.

Also, clean up some clippy lint complaints.
sys-ravenmki98 added a commit to sys-ravenmki98/azul that referenced this pull request Sep 29, 2025
Unfortunately, we can't use ctx.id.name to find a Durable Object's name within the DO itself (this previously worked only for local testing, but has been removed: cloudflare/workerd#4351). Instead, we can iterate over all possible names for the durable object based on the app configuration until we find the correct one.

Also, clean up some clippy lint complaints.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants