You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ssr.nonce set after the router is created no longer reaches the hydration scripts (regression in 1.171.31) #8789
Before #8204, injectScript and the $tsr barrier script read it each time they wrote a script, so an app could set the nonce after the router was created, for example in the createStartHandler callback. Now the hydration <script data-tsr-stream-part> and the trailing inline <script> render without a nonce, a nonce-based CSP blocks them, and hydration fails with TypeError: Cannot set properties of undefined (setting 't'). The module script still gets the nonce, and nothing fails on the server.
Set ssr.nonce in the createStartHandler callback as above, and send a CSP with script-src 'nonce-<n>'.
Build and serve with router-core 1.171.30 (react-start 1.168.54). Every inline script has the nonce and the page hydrates.
Upgrade to router-core 1.171.31 (react-start 1.168.55). The two inline scripts lose the nonce, the console reports two CSP violations and the TypeError, and the page content disappears. Still present in react-start 1.169.3 (router-core 1.171.38).
Setting the nonce in getRouter() (passing it in as request context) works around it.
Expected behavior
Either the hydration scripts pick up a nonce set any time before rendering, as before, or the docs say ssr.nonce must be set when the router is created, and a dev-mode warning catches a nonce that changes after the SSR utilities are attached.
Activity
aliassar commentedon Nov 2, 2026
Can I work on this?
TrevorBurnham commentedon Nov 2, 2026
Please do!