-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
When an error is throw in an endpoint get() method, it's not passed to handleError if called as a shadow endpoint via SSR.
Calling the endpoint manually with fetch(), or fetching the shadow endpoint by means of a client-side navigation all trigger handleError as expected.
I believe this is the problem I'm trying to wrap my head around in this discussion.
Reproduction
I've made a simple reproduction here: https://github.com/georgecrawford/sveltekit-shadow-endpoint-handle-error (also available live in StackBlitz here: https://stackblitz.com/edit/node-wy166v?file=src%2Fhooks.js&terminal=dev).
There are two endpoints, both of which throw an Error inside get(). When the endpoint is called from a load() function, both SSR and browser routing will cause the error to be handled by handleError. However, when an endpoint is called as a shadow endpoint, the SSR version doesn't hit handleError (whereas the browser-routed shadow load does as expected).
Logs
No response
System Info
System:
OS: macOS 11.6.2
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 202.62 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 16.4.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.19.0 - /usr/local/bin/npm
Watchman: 2021.09.06.00 - /usr/local/bin/watchman
Browsers:
Chrome: 98.0.4758.80
Chrome Canary: 100.0.4878.0
Firefox: 92.0.1
Safari: 15.2
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.17
@sveltejs/kit: next => 1.0.0-next.262
svelte: ^3.44.0 => 3.46.4Severity
blocking an upgrade
Additional Information
No response