-
Notifications
You must be signed in to change notification settings - Fork 10k
Durable Objects getByName API changelog #24664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/content/changelog/durable-objects/2025-08-21-durable-objects-get-by-name.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| --- | ||
| title: New getByName() API to access Durable Objects | ||
| description: Get a Durable Object client with a single line of code. | ||
| products: | ||
| - durable-objects | ||
| - workers | ||
| date: 2025-08-21 | ||
| --- | ||
|
|
||
| You can now create a client (a [Durable Object stub](/durable-objects/api/stub/)) to a Durable Object with the new `getByName` method, removing the need to convert Durable Object names to IDs and then create a stub. | ||
|
|
||
| ```js | ||
| // Before: (1) translate name to ID then (2) get a client | ||
| const objectId = env.MY_DURABLE_OBJECT.idFromName("foo"); // or .newUniqueId() | ||
| const stub = env.MY_DURABLE_OBJECT.get(objectId); | ||
|
|
||
| // Now: retrieve client to Durable Object directly via its name | ||
| const stub = env.MY_DURABLE_OBJECT.getByName("foo"); | ||
|
|
||
| // Use client to send request to the remote Durable Object | ||
| const rpcResponse = await stub.sayHello(); | ||
| ``` | ||
|
|
||
| Each Durable Object has a globally-unique name, which allows you to send requests to a specific object from anywhere in the world. Thus, a Durable Object can be used to coordinate between multiple clients who need to work together. You can have billions of Durable Objects, providing isolation between application tenants. | ||
|
|
||
| To learn more, visit the Durable Objects [API Documentation](/durable-objects/api/namespace/#getbyname) or the [getting started guide](/durable-objects/get-started/). | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.