{"action":"created","issue":{"url":"https://api.github.com/repos/rackt/react-router/issues/2115","labels_url":"https://api.github.com/repos/rackt/react-router/issues/2115/labels{/name}","comments_url":"https://api.github.com/repos/rackt/react-router/issues/2115/comments","events_url":"https://api.github.com/repos/rackt/react-router/issues/2115/events","html_url":"https://github.com/rackt/react-router/issues/2115","id":108744765,"number":2115,"title":"TypeError: Cannot read property 'query' of null - react-router/node_modules/history/lib/useQueries.js:43:22","user":{"login":"DWboutin","id":1322006,"avatar_url":"https://avatars.githubusercontent.com/u/1322006?v=3","gravatar_id":"","url":"https://api.github.com/users/DWboutin","html_url":"https://github.com/DWboutin","followers_url":"https://api.github.com/users/DWboutin/followers","following_url":"https://api.github.com/users/DWboutin/following{/other_user}","gists_url":"https://api.github.com/users/DWboutin/gists{/gist_id}","starred_url":"https://api.github.com/users/DWboutin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DWboutin/subscriptions","organizations_url":"https://api.github.com/users/DWboutin/orgs","repos_url":"https://api.github.com/users/DWboutin/repos","events_url":"https://api.github.com/users/DWboutin/events{/privacy}","received_events_url":"https://api.github.com/users/DWboutin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rackt/react-router/labels/needs-help","name":"needs-help","color":"0052cc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-09-28T20:55:04Z","updated_at":"2015-10-27T19:41:32Z","closed_at":"2015-10-08T20:54:15Z","body":"Hi, \r\n\r\nWe tried to migrate our app from react-router 0.13 to 1.0 and we got some big errors. \r\n\r\n{\"error\":\"TypeError: Cannot read property 'query' of null\\n    at .../node_modules/react-router/node_modules/history/lib/useQueries.js:43:22\\n    at .../node_modules/react-router/lib/useRoutes.js:252:15\\n    at .../node_modules/react-router/lib/useRoutes.js:88:15\\n    at .../node_modules/react-router/lib/useRoutes.js:124:15\\n    at done (.../node_modules/react-router/lib/AsyncUtils.js:49:19)\\n    at .../node_modules/react-router/lib/AsyncUtils.js:55:7\\n    at getComponentsForRoute (.../node_modules/react-router/lib/getComponents.js:9:5)\\n    at .../node_modules/react-router/lib/getComponents.js:28:5\\n    at .../node_modules/react-router/lib/AsyncUtils.js:54:5\\n    at Array.forEach (native)\"}\r\n\r\nWe added the History module, but it looks like the react-router use his own dependencies. \r\n\r\nIt's quite an easy isomorphic router we use;\r\n\r\n```js\r\nexport default function isomorphicRouter(location, history, store) {\r\n  let routes = createRoutes(store);\r\n\r\n  return new Promise((resolve, reject) => {\r\n    match({ routes, location }, (error, redirectLocation, renderProps) => {\r\n\r\n      let component;\r\n\r\n      if (error) {\r\n        return reject(error);\r\n      }\r\n\r\n      if (redirectLocation) {\r\n        return resolve({\r\n          redirectLocation,\r\n          isRedirect: true\r\n        });\r\n      }\r\n\r\n      if (history) {\r\n        renderProps.history = history;\r\n      }\r\n\r\n      component = (\r\n        <Provider store={store} key=\"provider\">\r\n          {() => <Router {...renderProps} children={routes} />}\r\n        </Provider>\r\n      );\r\n\r\n      return resolve({\r\n        component,\r\n        isRedirect: false\r\n      });\r\n    });\r\n  });\r\n}\r\n```\r\n\r\nAnd we use it in this server.js file;\r\n\r\n```js\r\nimport express from 'express';\r\nimport cookieParser from 'cookie-parser';\r\nimport bodyParser from 'body-parser';\r\nimport csrf from 'csurf';\r\nimport createStore from './redux/create';\r\nimport ApiClient from './api-client';\r\nimport createLocation from 'history/lib/createLocation';\r\nimport React from 'react';\r\nimport Html from './html';\r\nimport PrettyError from 'pretty-error';\r\nimport isomorphicRouter from './isomorphic-router';\r\nimport {API_PORT} from './utils/consts';\r\nimport httpProxy from 'http-proxy';\r\n\r\nlet server = express();\r\nlet port = process.env.PORT || 4000;\r\nlet env = server.get('env');\r\nlet csrfProtection = csrf({\r\n  cookie: true\r\n});\r\nlet pretty = new PrettyError();\r\n\r\nlet proxy = httpProxy.createProxyServer({\r\n  target: 'http://localhost:' + API_PORT\r\n});\r\n\r\nproxy.on('error', (error) => {\r\n  log('proxy error', error);\r\n});\r\n\r\nserver.use('/', express.static(__dirname + '/../build'));\r\nserver.use(cookieParser());\r\n\r\n// Proxy to the API service gateway.\r\nserver.use('/api', (req, res) => {\r\n  proxy.web(req, res);\r\n});\r\n\r\nserver.use(bodyParser.json());\r\n\r\nserver.use(csrfProtection, (req, res) => {\r\n  let client = new ApiClient(req);\r\n  let store = createStore(client);\r\n  let location = createLocation(req.url);\r\n\r\n  if (IS_SSR_DISABLED) {\r\n    res.send('<!DOCTYPE html>\\n' + React.renderToString(<Html component={<div />} store={store} />));\r\n  } else {\r\n    isomorphicRouter(location, undefined, store)\r\n      .then(({component, redirectLocation, isRedirect}) => {\r\n        if (isRedirect) {\r\n          res.redirect(redirectLocation.pathname);\r\n\r\n          return;\r\n        }\r\n\r\n        res.send('<!DOCTYPE html>\\n' + React.renderToString(<Html component={component} store={store} />));\r\n      })\r\n      .catch((error) => {\r\n        if (error.redirect) {\r\n          res.redirect(error.redirect);\r\n\r\n          return;\r\n        }\r\n\r\n        log('ROUTER ERROR:', pretty.render(error));\r\n        res.status(500).send({\r\n          error: error.stack\r\n        });\r\n      });\r\n  }\r\n});\r\n\r\nserver.listen(port, () => {\r\n  if (process.send) {\r\n    process.send('online');\r\n  } else {\r\n    log('listening on http://localhost:' + port + ' in ' + env + ' mode');\r\n  }\r\n});\r\n\r\nexport default server;\r\n```\r\n\r\nIt it the `let location = createLocation(req.url);` who is not initialized correctly? I'm very lost in migrating the new changes. Thank you for your help!"},"comment":{"url":"https://api.github.com/repos/rackt/react-router/issues/comments/151620862","html_url":"https://github.com/rackt/react-router/issues/2115#issuecomment-151620862","issue_url":"https://api.github.com/repos/rackt/react-router/issues/2115","id":151620862,"user":{"login":"aackerman","id":786640,"avatar_url":"https://avatars.githubusercontent.com/u/786640?v=3","gravatar_id":"","url":"https://api.github.com/users/aackerman","html_url":"https://github.com/aackerman","followers_url":"https://api.github.com/users/aackerman/followers","following_url":"https://api.github.com/users/aackerman/following{/other_user}","gists_url":"https://api.github.com/users/aackerman/gists{/gist_id}","starred_url":"https://api.github.com/users/aackerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aackerman/subscriptions","organizations_url":"https://api.github.com/users/aackerman/orgs","repos_url":"https://api.github.com/users/aackerman/repos","events_url":"https://api.github.com/users/aackerman/events{/privacy}","received_events_url":"https://api.github.com/users/aackerman/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T19:41:32Z","updated_at":"2015-10-27T19:41:32Z","body":"This is caused by a disconnect between the internal `history` lib dependency in `react-router` and your app `history` lib dependency version. It would imagine it should work if the versions match."}}