Skip to content

[Durable Objects] Add changelog for ctx.id.name support#30843

Merged
rianvdm merged 1 commit into
productionfrom
changelog-do-id-name
May 15, 2026
Merged

[Durable Objects] Add changelog for ctx.id.name support#30843
rianvdm merged 1 commit into
productionfrom
changelog-do-id-name

Conversation

@iglesiasbrandon

Copy link
Copy Markdown
Collaborator

Summary

Adds a changelog entry dated 2026-03-26 documenting that ctx.id.name is now populated inside a Durable Object when accessed via idFromName() or getByName().

The entry:

  • Highlights that the in-Durable-Object ctx.id.name value now matches what the client sees on the stub's ID.
  • Explains the prior pain point (TypeScript types implied name would be populated, but it was always undefined inside the Durable Object).
  • Documents the four cases where name is undefined (unique IDs, idFromString(), names > 1024 bytes).

References

Add changelog entry dated 2026-03-26 documenting that ctx.id.name is now
populated inside a Durable Object when accessed via idFromName() or
getByName(), matching the name visible on the client-side stub.
@github-actions

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/changelog/ @cloudflare/pm-changelogs, @cloudflare/product-owners

@rianvdm
rianvdm merged commit 3fa3683 into production May 15, 2026
18 checks passed
@rianvdm
rianvdm deleted the changelog-do-id-name branch May 15, 2026 20:34
date: 2026-03-26
---

`ctx.id.name` inside a Durable Object now matches what you see client-side. If a Worker accesses a Durable Object via `idFromName()` or `getByName()`, the same name is now available on `ctx.id.name` inside the object — no need to pass it through method arguments or persist it in storage.

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.

Lead with your second sentence. The first sentence is confusing to a user - what is "what you see client-side".

When your Worker accesses a Durable Object via getByName()oridFromName(), ...

  • good to frame direct to user


`ctx.id.name` inside a Durable Object now matches what you see client-side. If a Worker accesses a Durable Object via `idFromName()` or `getByName()`, the same name is now available on `ctx.id.name` inside the object — no need to pass it through method arguments or persist it in storage.

Previously, the TypeScript type for `ctx.id` declared `name` as `string | undefined`, which led developers and LLM-based coding assistants to assume the name would be available inside the Durable Object. In reality, it was always `undefined` from inside, forcing manual workarounds.

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.

  • let's remove focus on what wasn't supported, distracts here. Instead can emphasize this now correctly matches the Workers runtime types


```js
export class ChatRoom extends DurableObject {
async fetch(request) {

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.

feature a RPC method over fetch()

products:
- durable-objects
- workers
date: 2026-03-26

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

hey @vy-ton did you add the correct link here?

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.

struggling to find what I was looking at, should just confirm @maxmcd when ctx.id.name was first available

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.


A few things to note about when `ctx.id.name` is set:

- **Populated** when the Durable Object is accessed via `idFromName()` or `getByName()`.

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.

already said so can remove to avoid repeat

I would mention something about alarms - we want users to understand that ctx.id.name is something that is available no matter how the DO is invoked. For example, the passing in name as arguement doesnt work for alarms

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.

Does ctx.id.name work locally?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

- **Populated** when the Durable Object is accessed via `idFromName()` or `getByName()`.
- **`undefined`** for Durable Objects created with `newUniqueId()`.
- **`undefined`** when accessed via `idFromString()`, even if the ID was originally created from a name.
- **`undefined`** for names longer than 1,024 bytes.

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.

This raises user question of what the limit for DO names are. Let's make sure thats documented

iglesiasbrandon added a commit that referenced this pull request May 19, 2026
…30897)

Addresses review feedback from #30843:
- Rename file and update frontmatter date to 2026-03-15 to match the
  production rollout date documented in src/content/docs/durable-objects/api/id.mdx.
- Lead with the user-facing 'When your Worker accesses...' framing.
- Remove the TypeScript-types backstory; emphasize that runtime now
  matches the Workers runtime types.
- Replace the fetch() code example with an RPC method.
- Drop the redundant 'Populated' bullet; link the 1,024-byte caveat to
  the API reference.
- Call out alarms as a primary use case.
- Note that this works in local development with wrangler dev.

Co-authored-by: iglesiasbrandon <5313116+iglesiasbrandon@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants