Commit activity
Last 12 weeks · 42 commits
Community health
6 of 6 standards met
Recent PRs & issues
PR Checklist Please check if your PR fulfills the following requirements: [x] Addresses an existing open issue: fixes #2378 [x] Tests for the changes have been added (for bug fixes / features) What is the current behavior? An error that an API route or a middleware throws never reaches Nitro's hook or its , because the handler answers it inside its own h3 app and its never rejects. The steps and the details are in #2378. In SolidStart 1.5.1 the same API route's error reached Nitro's error hook. What is the new behavior? The first commit is the failing test, as in CONTRIBUTING's "Failing Test PR". The second commit is the proposed fix: When a route, a middleware or the handler itself throws an error that h3 would answer as unhandled, the handler's rejects with it, so the server hosting the handler answers and reports it. With Nitro, that means the hook, then the . These cases are answered as before: an h3 not marked unhandled, a status thrown as a number and h3's not-found and handled markers, by SolidStart; an error reached through , by SolidStart; an error reached through an h3 app that the handler is mounted in, by that app. SolidStart's own dev server (without Nitro) shows its existing error overlay for such errors, and its preview server answers them with a 500. Tests: is new, gets a test of the preview server, and the e2e test of the first commit now passes. A patch changeset is included. Other information This changes who answers an unhandled error: The handler's can now reject, unlike h3's . A server or adapter that calls it directly answers such an error itself. The host builds the error response. With Nitro, the body is Nitro's and a custom applies; headers set for the error response with on SolidStart's event are not in the host's answer. #2378 has the full list of trade-offs (including the status and headers of the answer, which errors still do not reach the hook, server function requests that fail before the function runs) and two alternatives that keep SolidStart's answers (calling Nitro's , or an error option on the handler). The e2e test runs under ; I also ran a production build of a new app with packed from this branch: the hook gets the API route's error and Nitro answers the 500. I pushed the fix now, rather than waiting for an answer on the approach, so that the approach can be judged with the code. If you prefer one of the alternatives or another approach, I will change this pull request.
Duplicates [x] I have searched the existing issues Latest version [x] I have tested the latest version Current behavior 😯 With Nitro, an error thrown by an API route or a middleware never reaches Nitro's hook or its . Error reporters that listen on that hook do not see these errors, and a custom does not apply to them. () serves the app through an h3 app of its own (). h3 turns whatever a handler throws into a response, so the handler's never rejects. Nitro's SSR renderer gets h3's back as an ordinary response, and Nitro's , which calls the hook and then the , does not run. An error thrown by a Nitro route reaches the hook. In SolidStart 1.5.1 (vinxi 0.5.11 with nitropack 2.13.6), the same API route's error reached Nitro's hook too. Expected behavior 🤔 An unhandled error thrown by an API route or a middleware reaches Nitro's hook and , as an unhandled error of a Nitro route does. Steps to reproduce 🕹 Failing test and proposed fix: #2379 (the first commit is the failing e2e test, the second the fix). The steps below reproduce the bug in a new app. Steps: 1. Run , then and . 2. Add : 3. Add : and pass it to Nitro in : . 4. Run and , then . 5. The response is h3's JSON 500 and the server prints the error once (from h3), but is never printed. A Nitro route that throws (for example , added with ) prints . Context 🔦 We report server errors from Nitro's hook, so errors from our API routes and middleware go unreported. #1660 shows how an app can catch these errors itself, with an h3 middleware that wraps in /. That works when each app knows it needs that middleware and reports from it, or forwards the error with Nitro's . Otherwise, integrations that capture server errors from Nitro's hook do not see the error. Either way, Nitro's never answers it. Proposed fix. The fix, with unit tests, is in #2379. When a route, a middleware or the handler itself throws an error that h3 would answer as unhandled, the handler's rejects with it, so the server hosting the handler answers and reports it. With Nitro, that means the hook, then the . These cases are answered as before: an h3 not marked unhandled, or a status thrown as a number, by SolidStart; an error reached through , by SolidStart; an error reached through an h3 app that the handler is mounted in, by that app. SolidStart's own dev server (without Nitro) then shows its existing error overlay for such errors, and its preview server answers them with a 500. Trade-offs. The handler's can now reject, unlike h3's . A server or adapter that calls it directly answers such an error itself. The host builds the error response. With Nitro, the body is Nitro's ( in production) and a custom applies. An error that is not an h3 but carries a , which h3 used for its answer, now gets the host's 500, as it would in a Nitro route. Headers set for the error response with on SolidStart's event are not in the host's answer, because the host answers on its own event. Examples are headers from h3's CORS helpers and the that sets before it rethrows. So when SolidStart's middleware sets CORS headers with h3's helpers, a cross-origin client can no longer read such a 500. An h3 not marked unhandled (a 5xx too), or a status thrown as a number, is still answered by SolidStart, so it does not reach the hook, although in a Nitro route it would. Server function requests that fail before the function runs, such as an unknown function id, are now reported as unhandled errors. They were already answered as unhandled 500s. Alternatives. Two alternatives I considered keep SolidStart's answers as they are: calling Nitro's when Nitro hosts the app (the hook runs, the does not), or an error option on the handler, like (#1660 declined one for ). Why the proposed fix. Nitro runs SolidStart as a service and handles a service's errors itself: its dev worker deliberately does not catch them where it calls a service ("like production services, they propagate to the caller", ). The proposed fix lets an unhandled error take that path, as 1.x did. Of the three approaches, it is the only one where both the hook and the run, and it does not depend on Nitro: any server that calls the handler's gets the error, SolidStart's own dev server included. The two alternatives keep SolidStart's 500 and its headers, but the first needs Nitro-specific code in SolidStart and leaves out the , and the second changes nothing until each app or integration wires it up. The fix is in #2379, so that the approach can be judged with the code; if you prefer one of the alternatives or another approach, I will change the pull request. Not covered.** Errors thrown in a server function's body: SolidStart answers them by design and passes them to . Errors thrown while rendering a page: SolidStart answers them with its own 500 page. Your environment 🌎
Recent fixes
PR Checklist Please check if your PR fulfills the following requirements: [ ] Addresses an existing open issue: fixes #000 [x] Tests for the changes have been added (for bug fixes / features) What is the current behavior? In dev, plugins that pre-bundle server dependencies, such as the Cloudflare Vite plugin, end up with two copies of SolidStart's server function registry. Routes register their functions in one and the handler looks them up in the other, so calling a server function fails with . What is the new behavior? The server environment keeps out of pre-bundling, so server functions work in dev with these plugins. Environments that don't pre-bundle server dependencies, such as Nitro's, are unaffected. Other information To reproduce without Cloudflare, add to the basic template's Vite config and a button that calls a function, then click it in .
Calls that send files (, added in #2359) had no case in the dev toolbar's body viewer. They fell through to the generic multipart viewer, which showed: the field as one escaped raw string instead of a Seroval tree; the parts apart from the arguments, with the part's type instead of the file's. Changes : a case reads the form, shows with , and passes the form as . It falls back to if is missing. : an optional prop. A plugin node tagged shows a for its part, with the type, name and last modified time from the node (#2370), as the server deserializer does. Nodes without metadata show the part as it is. : exports . Testing and in . Ran and opened the call in the toolbar. (no type), the two attachment blobs and () inside the argument all show in place. 🤖 Generated with Claude Code
Current behavior A route file can export both a page and a handler. When the returns , a request falls through to the page (see #2354). A request runs the same handler, but when it returns the server throws and answers 500: With a catch-all such as the in , every request to a URL without its own route returns 500. Link checkers, uptime monitors and crawlers send requests. Expected behavior A request gets the same status and headers as the matching request: here, the 404 page. Steps to reproduce 1. Add a route that exports a page and a that returns nothing for HTML requests: 2. Run . 3. Run . The response is . returns the page. already has this route, so step 3 reproduces there directly. Context throws "did not return a response" for every method except . Since #1661, falls back to the handler, so it needs the same exception. The branch has the same check. Your environment main () Node 22, Linux
Repository: solidjs/solid-start. Description: SolidStart, the Solid app framework Stars: 5924, Forks: 423. Primary language: TypeScript. Languages: TypeScript (90.8%), CSS (7.6%), JavaScript (1.6%). License: MIT. Homepage: https://docs.solidjs.com/solid-start/v2/ Topics: file-system-routing, fine-grained-reactivity, meta-framework, sdk, signals, solid-js, solidjs, solidstart, spa, ssr. Latest release: @solidjs/start@2.2.2 (6d ago). Open PRs: 2, open issues: 1. Last activity: 9h ago. Community health: 87%. Top contributors: ryansolid, nksaraf, nsarafpure, birkskyum, lxsmnsyc, github-actions[bot], atilafassina, brenelz, ghalle, Brendonovich and others.