Cannot read property 'pathname' of undefined
See original GitHub issueI can’t use this library because of the dependency issues, but when I copied most of the source code into my program, I started getting
Cannot read property ‘pathname’ of undefined
I believe it’s because you need to pass the router object as a prop, and I’m not sure if you need it in context. I’m referring to your line: https://github.com/adamsoffer/next-apollo/blob/master/src/withData.js#L43
VS in https://github.com/zeit/next.js/blob/canary/examples/with-apollo/lib/with-apollo-client.js#L27 they pass it as a prop
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:12 (6 by maintainers)
Top Results From Across the Web
React Router: Cannot read property 'pathname' of undefined
I've just started learning React and got stuck at this error. Uncaught TypeError: Cannot read property ...
Read more >Cannot read properties of undefined (reading 'pathname')
The error "Cannot read properties of undefined (reading 'pathname')" occurs when we don't set the to prop on a Link component in React...
Read more >TypeError: Cannot read property 'pathname' of undefined # ...
But I am getting a TypeError: Cannot read property 'pathname' of undefined error when simply following the docs.
Read more >Cannot read properties of undefined (reading 'pathname')
Do anyone have experience with this error? It seems to be from the <Router></Router> section because when I remove everything under that I...
Read more >cannot read properties of undefined (reading 'pathname ...
pathname is undefined because you've not correctly accessed it from the (presumably) passed location prop from route props. You've missed the props part....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hey @amitschandillia - turns out this is actually an issue with next. There’s an open issue for it here: https://github.com/zeit/next.js/issues/6042
Ahh…at least that’s some pointer in the right direction. Thanks! 😃