cloudflare/partykit partysub@2.1.0
cloudflare/partykit
Captured source
source ↗partysub@2.1.0
Repository: cloudflare/partykit
Tag: partysub@2.1.0
Published: 2026-04-24T20:17:29Z
Prerelease: no
Release notes:
Minor Changes
- #378 `f3ab44f` Thanks @threepointone! - Use native
ctx.id.nameto populatethis.name.
Durable Objects now expose ctx.id.name on every entry point (constructor, fetch, alarm, hibernating websocket handlers) when the DO is addressed via idFromName()/getByName(). PartyServer now uses this as the primary source of this.name, which simplifies routing, eliminates storage writes, and makes this.name available inside the constructor.
Changes in partyserver:
this.nameresolves fromthis.ctx.id.name. The apologeticworkerd#2240error message is gone.this.nameis now available inside the constructor and from class field initializers, not just aftersetName()/fetch()has run.routePartykitRequestno longer issues asetName()/_initAndFetch()RPC beforefetch(). The WebSocket path goes from 2 RPCs to 1; the HTTP path remains 1 RPC. Props, when supplied, are delivered to the DO via thex-partykit-propsrequest header, set afteronBeforeConnect/onBeforeRequesthooks run.getServerByNamecontinues to perform a single RPC to ensureonStart()has completed before returning, so user-defined RPC methods on the returned stub can rely on initialization being done. That RPC is now cheaper internally (no storage write; name is read fromctx.id.name).Serverno longer writes the__ps_namerecord to storage. Existing records remain on disk for backward compatibility and are only read insidealarm()as a fallback for alarms that were scheduled before 2026-03-15 (wherectx.id.nameis not carried into the alarm handler — see the Durable Objects ID docs).setName()and_initAndFetch()are marked@deprecated. They continue to work for backward compatibility.setName(name)now throws ifnamedoes not matchctx.id.name.- The
x-partykit-roomheader is still accepted as a fallback whenctx.id.nameis not available. - Error message when the name cannot be resolved has been rewritten to list the three real causes (unsupported addressing via
idFromString()/newUniqueId(), runtime too old to exposectx.id.name, or directstub.fetch()withoutroutePartykitRequest/getServerByName). - When reading
this.namethrows, it is becausectx.id.nameis undefined and no legacy fallback has populated the name: the DO was addressed viaidFromString()ornewUniqueId()(both unsupported), the runtime is too old to exposectx.id.name, or a pre-2026-03-15 alarm fired before the legacy storage fallback ran.
Changes in all affected packages (partyserver, partysub, partysync, y-partyserver, hono-party):
@cloudflare/workers-typespeer dependency bumped from^4.20240729.0to^4.20260424.1. The old range predatesctx.id.namein the type surface.
Not supported: addressing PartyServer DOs via idFromString() or newUniqueId(). These paths return ctx.id.name === undefined inside the DO and will surface as a clear error from this.name. PartyServer has always assumed name-based addressing via getServerByName / routePartykitRequest; this release makes that assumption explicit.