From 217fef600dd05772bf6cf773877ea13d08aa1cbb Mon Sep 17 00:00:00 2001 From: Tim Smart Date: Fri, 17 Apr 2026 09:57:11 +1200 Subject: [PATCH] backport cluster serialization fix for notify path --- .changeset/major-lands-shake.md | 5 +++++ packages/cluster/src/Runners.ts | 16 ++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 .changeset/major-lands-shake.md diff --git a/.changeset/major-lands-shake.md b/.changeset/major-lands-shake.md new file mode 100644 index 00000000000..7d1349f30e7 --- /dev/null +++ b/.changeset/major-lands-shake.md @@ -0,0 +1,5 @@ +--- +"@effect/cluster": patch +--- + +backport cluster serialization fix for notify path diff --git a/packages/cluster/src/Runners.ts b/packages/cluster/src/Runners.ts index e675f24362c..c69b9a7764c 100644 --- a/packages/cluster/src/Runners.ts +++ b/packages/cluster/src/Runners.ts @@ -590,12 +590,16 @@ export const makeRpc: Effect.Effect< if (Option.isNone(address)) { return Effect.void } - const envelope = message.envelope - return RcMap.get(clients, address.value).pipe( - Effect.flatMap((client) => client.Notify({ envelope })), - Effect.scoped, - Effect.ignore - ) + const encode: Effect.Effect = + message._tag === "OutgoingRequest" + ? Effect.orDie(Message.serializeRequest(message)) + : Effect.succeed(message.envelope) + return Effect.flatMap(encode, (envelope) => + RcMap.get(clients, address.value).pipe( + Effect.flatMap((client) => client.Notify({ envelope })), + Effect.scoped, + Effect.ignore + )) }, onRunnerUnavailable: (address) => RcMap.invalidate(clients, address) })