You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This approach works with all of the [ID methods](/durable-objects/api/id/).
30
30
31
-
Methods on a [`DurableObjectNamespace`](/durable-objects/api/namespace/) that take a [`DurableObjectId`](/durable-objects/api/id) as a parameter will throw an exception if the parameter is associated with a different jurisdiction. To achieve this, a [`DurableObjectId`](/durable-objects/api/id) encodes its jurisdiction. As a consequence, it is possible to have the same name represent different IDs in different jurisdictions.
31
+
:::caution[Do not use `newUniqueId(jurisdiction)`]
32
+
33
+
When specifying a jurisdiction, Cloudflare recommends you first create a namespace restricted to a jurisdiction, as explained above.
34
+
35
+
Note that it is possible to specify a jurisdiction by creating an individual [`DurableObjectId`](/durable-objects/api/id) restricted to a jurisdiction.
36
+
37
+
**However, Cloudflare does not recommend this approach.**
38
+
39
+
This approach is only documented for completeness.
- As a consequence, it is possible to have the same name represent different IDs in different jurisdictions.
46
+
- You will run into an error if the jurisdiction on your [`DurableObjectNamespace`](/durable-objects/api/namespace/) and the jurisdiction on [`DurableObjectId`](/durable-objects/api/id) are different.
47
+
- You will not run into an error if the [`DurableObjectNamespace`](/durable-objects/api/namespace/) is not associated with a jurisdiction.
console.assert(!euId1.equal(euId2), "This should always be true");
37
53
```
38
-
However, these methods will not throw an exception if the [`DurableObjectNamespace`](/durable-objects/api/namespace/) is not associated with a jurisdiction. The common case is that any valid [`DurableObjectId`](/durable-objects/api/id) can be used in the top-level namespace's methods.
54
+
:::
55
+
56
+
The common case is that any valid [`DurableObjectId`](/durable-objects/api/id) can be used in the top-level namespace's methods.
:::caution[Do not use `newUniqueId(jurisdiction)`]
47
-
Note that it is possible to specify a jurisdiction by creating an individual [`DurableObjectId`](/durable-objects/api/id) restricted to a jurisdiction:
0 commit comments