Skip to content

fix(server): propagate effect errors to error boundaries (closes #2777)#2778

Open
tsushanth wants to merge 1 commit into
solidjs:nextfrom
tsushanth:fix-server-effect-error-swallow
Open

fix(server): propagate effect errors to error boundaries (closes #2777)#2778
tsushanth wants to merge 1 commit into
solidjs:nextfrom
tsushanth:fix-server-effect-error-swallow

Conversation

@tsushanth

Copy link
Copy Markdown

Summary

Closes #2777.

serverEffect in packages/solid/src/server/signals.ts was wrapping the compute / effect path in try { … } catch (err) { /* Swallow errors from effects on server */ }. That left SSR producing successful child HTML even when a render-effect threw — and silently diverged from the client/hydration path where the same kind of error would reach the surrounding <Errored> / createErrorBoundary. As reporter notes, the error also disappears from every diagnostic path, so it can't be logged either.

Mirror how serverSignal's pull path already 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 a wrapping boundary can catch them.

Repro / test commands

Added a regression case to the existing Server createErrorBoundary describe block in packages/solid/test/server/signals.spec.ts:

test("catches errors thrown from createEffect on the server (#2777)", () => {
  createRoot(() => {
    const result = createErrorBoundary(
      () => {
        createEffect(() => { throw new Error("server effect boom"); }, () => {});
        return "children";
      },
      (err) => `caught: ${(err() as Error).message}`
    );
    expect(result()).toBe("caught: server effect boom");
  }, { id: "test" });
});
pnpm --filter @solidjs/signals build
pnpm --filter ./packages/solid test test/server/signals.spec.ts

Result: 48/48 pass, including the new regression. The reporter's StackBlitz now produces error: server effect boom instead of children when wrapped in <Errored>.

Notes

Written by an agent (Claude Code, claude-opus-4-7).

…djs#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 solidjs#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` / `<Errored>` can catch
them.

Add a regression case under the existing 'Server createErrorBoundary'
suite that throws from `createEffect` and asserts the boundary
catches it.
@changeset-bot

changeset-bot Bot commented Jun 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a19a506

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant