Vue version
3.5.43
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-kyxtdywv?file=main.js
Steps to reproduce
Open the reproduction link, which performs the following steps:
- Throws an error from a component's async setup.
- Renders the component using
renderToString.
What is expected?
The error should propagate up to the renderToString call, causing it to return a rejected promise.
In the minimal reproduction, that rejection would be uncaught, so the error would appear in the Node.js console.
What is actually happening?
There's no uncaught error or unhandled promise rejection. The console only displays the following warnings:
[Vue warn]: Unhandled error during execution of setup function
at <App>
[Vue warn]: Component App is missing template or render function.
at <App>
Also, if there is a render function in the component throwing the error, it renders successfully as if no error occurred.
Any additional comments?
This bug is caused by 349eb0f#diff-96591cb7eb061552355cc70e508472b1acc2688c3449ad0daa19c3cbac08cc97R100, where onServerPrefetch was added. Originally, the bug only occurred when the setup synchronously calls onServerPrefetch.
That line intended to catch errors thrown from onServerPrefetch callbacks, but the .catch was mistakenly applied to the entire setup promise.
The bug was expanded to occur in all async setups in 6039e25#diff-96591cb7eb061552355cc70e508472b1acc2688c3449ad0daa19c3cbac08cc97R110 by no longer gating the .catch behind if (prefetches).
Vue version
3.5.43
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-kyxtdywv?file=main.js
Steps to reproduce
Open the reproduction link, which performs the following steps:
renderToString.What is expected?
The error should propagate up to the
renderToStringcall, causing it to return a rejected promise.In the minimal reproduction, that rejection would be uncaught, so the error would appear in the Node.js console.
What is actually happening?
There's no uncaught error or unhandled promise rejection. The console only displays the following warnings:
Also, if there is a render function in the component throwing the error, it renders successfully as if no error occurred.
Any additional comments?
This bug is caused by 349eb0f#diff-96591cb7eb061552355cc70e508472b1acc2688c3449ad0daa19c3cbac08cc97R100, where
onServerPrefetchwas added. Originally, the bug only occurred when the setup synchronously callsonServerPrefetch.That line intended to catch errors thrown from
onServerPrefetchcallbacks, but the.catchwas mistakenly applied to the entire setup promise.The bug was expanded to occur in all async setups in 6039e25#diff-96591cb7eb061552355cc70e508472b1acc2688c3449ad0daa19c3cbac08cc97R110 by no longer gating the
.catchbehindif (prefetches).