Skip to content

fix: await server function error handlers - #2269

Merged
birkskyum merged 5 commits into
solidjs:mainfrom
birkskyum:fix/await-server-function-error-handler
Jul 30, 2026
Merged

fix: await server function error handlers#2269
birkskyum merged 5 commits into
solidjs:mainfrom
birkskyum:fix/await-server-function-error-handler

Conversation

@birkskyum

@birkskyum birkskyum commented Jul 29, 2026

Copy link
Copy Markdown
Member

Await serverFunctions.onError handlers before serializing errors. Async handlers resolving to undefined preserve the original error.

Includes regression tests and updated documentation.

cc @adipascu

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b608338

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/start Patch

Not sure what this means? Click here to learn what changesets are.

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

@netlify

netlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

Deploy Preview for solid-start-landing-page ready!

Name Link
🔨 Latest commit b608338
🔍 Latest deploy log https://app.netlify.com/projects/solid-start-landing-page/deploys/6a6aa690ecea580008286a55
😎 Deploy Preview https://deploy-preview-2269--solid-start-landing-page.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Jul 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/start@2269

commit: b608338

@birkskyum
birkskyum requested a review from brenelz July 29, 2026 17:24
@birkskyum
birkskyum requested a review from lxsmnsyc July 29, 2026 17:28
@birkskyum birkskyum added the Start 2.x targeting SolidStart 2.x versions label Jul 29, 2026
@adipascu

Copy link
Copy Markdown
Contributor

Ran my production handler under the awaited contract, every path behaves the same and sync handlers are unaffected. Drop-in for me, thanks.

One edge worth a guard: the call sits inside catch (x), so a handler that throws or rejects (a failed await flush() is now the easy way there) escapes handleServerFunction, and the client gets an opaque 500 with no X-Error in place of the original error.

try {
  const replacement = await onServerFunctionError?.(thrown);
  return replacement ?? thrown;
} catch {
  return thrown;
}

A spec for a rejecting handler and one for an async handler resolving to a Response would pin these down.

@birkskyum

birkskyum commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

@adipascu , good ideas, added the spec, and the reutrn of the original error.

@birkskyum
birkskyum merged commit 3573985 into solidjs:main Jul 30, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Start 2.x targeting SolidStart 2.x versions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug?]: an async serverFunctions.onError handler is not awaited

3 participants