Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(server-renderer): propagate sync errors from ssrRenderSuspense#14804

Merged
edison1105 merged 2 commits into
vuejs:mainfrom
danielroe:fix/ssr-async-component-render-error-swallowed
May 27, 2026
Merged

fix(server-renderer): propagate sync errors from ssrRenderSuspense#14804
edison1105 merged 2 commits into
vuejs:mainfrom
danielroe:fix/ssr-async-component-render-error-swallowed

Conversation

@danielroe

@danielroe danielroe commented May 11, 2026

Copy link
Copy Markdown
Member

resolves nuxt/nuxt#28162

we want errors when rendering to throw - but at the moment a sync throw inside the default slot gets converted by the async-function machinery into a rejected Promise<void> that is then thrown away...

Summary by CodeRabbit

  • Bug Fixes

    • Fixed error propagation in server-side rendering with Suspense to ensure synchronous errors are correctly handled and reported during rendering.
  • Tests

    • Added test case to verify synchronous error handling in Suspense rendering scenarios.

Review Change Stack

@pkg-pr-new

pkg-pr-new Bot commented May 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@14804
npm i https://pkg.pr.new/@vue/compiler-core@14804
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@14804
npm i https://pkg.pr.new/@vue/compiler-dom@14804
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@14804
npm i https://pkg.pr.new/@vue/compiler-sfc@14804
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@14804
npm i https://pkg.pr.new/@vue/compiler-ssr@14804
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@14804
npm i https://pkg.pr.new/@vue/reactivity@14804
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@14804
npm i https://pkg.pr.new/@vue/runtime-core@14804
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@14804
npm i https://pkg.pr.new/@vue/runtime-dom@14804
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@14804
npm i https://pkg.pr.new/@vue/server-renderer@14804
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@14804
npm i https://pkg.pr.new/@vue/shared@14804
yarn add https://pkg.pr.new/@vue/[email protected]

vue

pnpm add https://pkg.pr.new/vue@14804
npm i https://pkg.pr.new/vue@14804
yarn add https://pkg.pr.new/[email protected]

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@14804
npm i https://pkg.pr.new/@vue/compat@14804
yarn add https://pkg.pr.new/@vue/[email protected]

commit: 1065869

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f8fc917e-cb91-4727-9670-7045f597f91a

📥 Commits

Reviewing files that changed from the base of the PR and between 57545e9 and 7344e16.

📒 Files selected for processing (2)
  • packages/server-renderer/__tests__/ssrSuspense.spec.ts
  • packages/server-renderer/src/helpers/ssrRenderSuspense.ts

📝 Walkthrough

Walkthrough

The pull request makes ssrRenderSuspense synchronous instead of async to ensure synchronous errors thrown during server-side Suspense rendering propagate correctly to renderToString. When compiled code calls an async function without awaiting it, any Promise rejection is silently discarded; removing the async wrapper causes exceptions to throw immediately. A new test validates this behavior.

Changes

SSR Suspense Error Propagation

Layer / File(s) Summary
Function Signature & Documentation
packages/server-renderer/src/helpers/ssrRenderSuspense.ts
ssrRenderSuspense changes from export async function returning Promise<void> to export function returning void. Documentation comments explain that synchronous behavior is required to prevent compiled output from discarding unawaited Promise rejections.
Runtime Logic
packages/server-renderer/src/helpers/ssrRenderSuspense.ts
Existing runtime branching logic (render content if present, else push HTML comment marker) remains unchanged but now executes synchronously.
Test & Imports
packages/server-renderer/__tests__/ssrSuspense.spec.ts
Imports are updated to include defineComponent and ssrRenderSuspense. A new test case asserts that synchronous exceptions thrown by a compiled ssrRenderSuspense default slot callback propagate correctly and cause renderToString to reject with the thrown error.

🎯 2 (Simple) | ⏱️ ~12 minutes

🐰 A function shed its async coat,
So errors won't sail away in a boat,
Now renderToString will see the mistake,
No swallowed rejections to undertake!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing synchronous error propagation from ssrRenderSuspense, which is the primary objective of the changeset.
Linked Issues check ✅ Passed The pull request addresses the core requirement from issue #28162 by ensuring that synchronous rendering errors in SSR are propagated instead of being swallowed by async machinery.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing SSR error propagation: modifying ssrRenderSuspense to be synchronous and adding a test to verify error handling.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 106 kB 40 kB 36 kB
vue.global.prod.js 164 kB 60 kB 53.4 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 48.7 kB 18.9 kB 17.3 kB
createApp 56.8 kB 22 kB 20.1 kB
createSSRApp 61.1 kB 23.7 kB 21.6 kB
defineCustomElement 63 kB 23.9 kB 21.8 kB
overall 71.6 kB 27.4 kB 25 kB

@edison1105 edison1105 added ready to merge The PR is ready to be merged. scope: ssr labels May 12, 2026
@edison1105

Copy link
Copy Markdown
Member

/ecosystem-ci run

@vue-bot

vue-bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

📝 Ran ecosystem CI: Open

suite result latest scheduled
pinia success success
quasar failure failure
test-utils success success
nuxt failure success
vite-plugin-vue success success
vuetify success success
router success success
vitepress success success
vant success success
language-tools success success
vue-macros success success
primevue success success
vue-i18n success success
vue-simple-compiler success success
vueuse success success
radix-vue success success

@edison1105 edison1105 merged commit 4760997 into vuejs:main May 27, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge The PR is ready to be merged. scope: ssr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

render issues does not throw in SSR

3 participants