ReactReduxSpa template logs strange messages when there's a client-side 404 #1622

Closed
opened 2025-08-09 17:20:58 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @SteveSandersonMS on 5/17/2016

The ReactReduxSpa template's server-side prerendering code works well when the client-side routes are matched, but if they fail to match, it logs errors like this:

[Node] Warning: Failed propType: Required prop `router` was not specified in `RouterContext`.
[Node] Warning: Failed propType: Required prop `location` was not specified in `RouterContext`.
[Node] Warning: Failed propType: Required prop `routes` was not specified in `RouterContext`.
[Node] Warning: Failed propType: Required prop `params` was not specified in `RouterContext`.
[Node] Warning: Failed propType: Required prop `components` was not specified in `RouterContext`.
[Node] Warning: [react-router] `<RouterContext>` expects a `router` rather than a `history`
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[0]
      An unhandled exception has occurred while executing the request
System.Exception: Call to Node module failed with error: TypeError: Cannot read property 'listenBeforeLeavingRoute' of undefined
    at getChildContext (NodeServices/templates/ReactReduxSpa/node_modules/react-router/lib/RouterContext.js:80:35)
    at ReactCompositeComponentMixin._processChildContext (/NodeServices/templates/ReactReduxSpa/node_modules/react/lib/ReactCompositeComponent.js:413:53)

This is confusing because it doesn't say anywhere what the underlying cause was (a request that doesn't match any client-side route) and looks worse than it is.

Somehow, boot-server.tsx needs to handle this situation better.

*Originally created by @SteveSandersonMS on 5/17/2016* The ReactReduxSpa template's server-side prerendering code works well when the client-side routes are matched, but if they fail to match, it logs errors like this: ``` [Node] Warning: Failed propType: Required prop `router` was not specified in `RouterContext`. [Node] Warning: Failed propType: Required prop `location` was not specified in `RouterContext`. [Node] Warning: Failed propType: Required prop `routes` was not specified in `RouterContext`. [Node] Warning: Failed propType: Required prop `params` was not specified in `RouterContext`. [Node] Warning: Failed propType: Required prop `components` was not specified in `RouterContext`. [Node] Warning: [react-router] `<RouterContext>` expects a `router` rather than a `history` fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[0] An unhandled exception has occurred while executing the request System.Exception: Call to Node module failed with error: TypeError: Cannot read property 'listenBeforeLeavingRoute' of undefined at getChildContext (NodeServices/templates/ReactReduxSpa/node_modules/react-router/lib/RouterContext.js:80:35) at ReactCompositeComponentMixin._processChildContext (/NodeServices/templates/ReactReduxSpa/node_modules/react/lib/ReactCompositeComponent.js:413:53) ``` This is confusing because it doesn't say anywhere what the underlying cause was (a request that doesn't match any client-side route) and looks worse than it is. Somehow, `boot-server.tsx` needs to handle this situation better.
fergalmoran added the bugbugbugbugbugbugbug labels 2025-08-09 17:20:58 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1622
No description provided.