question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'pathname' of undefined

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
adamsoffercommented, Jul 26, 2019

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

1reaction
amitschandilliacommented, Jul 26, 2019

Ahh…at least that’s some pointer in the right direction. Thanks! 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found