React-router: TypeError: Cannot read property 'match' of undefined

Created on 3 Oct 2015  路  6Comments  路  Source: ReactTraining/react-router

I am getting this error when trying to render on server. Here is the complete traceback.

TypeError: Cannot read property 'match' of undefined
at Object.matchPattern (/Users/carlitux/Projects/djarana/node_modules/react-router/lib/PatternUtils.js:107:23)
at matchRouteDeep (/Users/carlitux/Projects/djarana/node_modules/react-router/lib/matchRoutes.js:60:37)
at /Users/carlitux/Projects/djarana/node_modules/react-router/lib/matchRoutes.js:127:5
at next (/Users/carlitux/Projects/djarana/node_modules/react-router/lib/AsyncUtils.js:20:12)
at Object.loopAsync (/Users/carlitux/Projects/djarana/node_modules/react-router/lib/AsyncUtils.js:26:3)
at Object.matchRoutes as default
at Object.match (/Users/carlitux/Projects/djarana/node_modules/react-router/lib/useRoutes.js:82:33)
at match (/Users/carlitux/Projects/djarana/node_modules/react-router/lib/match.js:38:17)

All 6 comments

I found the error!

If anyone else came across this error (as I did), the problem was that I was not using history.createLocation when assigning the req.url location to my server router.

@bradbumbalough yeah. That was my error, too.

Fixed my error, too.

We should update the docs

@oscar-g actually it seems the docs are correct. The API for the match() changed since 1.0.0-rc1 in master. So if you need to use the docs from the 1.0.0-rc1 tag.

You're right, I'm on an earlier react-router version looking at the docs on master!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Waquo picture Waquo  路  3Comments

ryansobol picture ryansobol  路  3Comments

alexyaseen picture alexyaseen  路  3Comments

jzimmek picture jzimmek  路  3Comments

misterwilliam picture misterwilliam  路  3Comments