From a19a506e014546abc4507328be8d4fc0c884cbc3 Mon Sep 17 00:00:00 2001 From: tsushanth <78000697+tsushanth@users.noreply.github.com> Date: Sat, 13 Jun 2026 06:32:59 -0700 Subject: [PATCH] fix(server): propagate effect errors to error boundaries (closes #2777) `serverEffect` was swallowing every exception inside the compute/effect path with a bare `catch (err) {}`. That made SSR output 'children' HTML even after the render-effect threw, and diverged from the client/hydration path where the same error would reach the surrounding boundary. Reporter on #2777 also called out that the error vanishes from any diagnostic/log path. Mirror how `serverSignal`'s pull path handles the same situation (L630-634): NotReadyError is suspense control flow and must keep propagating, real errors get recorded on the computation and re-thrown so `createErrorBoundary` / `` can catch them. Add a regression case under the existing 'Server createErrorBoundary' suite that throws from `createEffect` and asserts the boundary catches it. --- packages/solid/src/server/signals.ts | 9 ++++++++- packages/solid/test/server/signals.spec.ts | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/packages/solid/src/server/signals.ts b/packages/solid/src/server/signals.ts index ae203f7e6..72bd12056 100644 --- a/packages/solid/src/server/signals.ts +++ b/packages/solid/src/server/signals.ts @@ -935,7 +935,14 @@ function serverEffect( } effectFn?.((ssrSource ? (comp.value ?? result) : result) as any, undefined); } catch (err) { - // Swallow errors from effects on server + // NotReadyError is suspense control flow — must keep propagating so the + // surrounding Loading boundary can react. For real errors, record on the + // computation and re-throw so a wrapping `createErrorBoundary` / + // `` can catch instead of the error vanishing into the void + // (#2777). + if (err instanceof NotReadyError) throw err; + comp.error = err; + throw err; } } diff --git a/packages/solid/test/server/signals.spec.ts b/packages/solid/test/server/signals.spec.ts index 758ce35e2..4d3a883cb 100644 --- a/packages/solid/test/server/signals.spec.ts +++ b/packages/solid/test/server/signals.spec.ts @@ -417,6 +417,27 @@ describe("Server createErrorBoundary", () => { { id: "test" } ); }); + + test("catches errors thrown from createEffect on the server (#2777)", () => { + createRoot( + () => { + const result = createErrorBoundary( + () => { + createEffect( + () => { + throw new Error("server effect boom"); + }, + () => {} + ); + return "children"; + }, + (err: () => unknown) => `caught: ${(err() as Error).message}` + ); + expect(result()).toBe("caught: server effect boom"); + }, + { id: "test" } + ); + }); }); // === createLoadingBoundary ===