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 'pages' of undefined

See original GitHub issue

const d = wtf('2018', 'de');

I tried to fetch: https://de.wikipedia.org/wiki/2018

causes Unhandled Rejection at: Promise { <rejected> TypeError: Cannot read property ‘pages’ of undefined at postProcess (/var/task/node_modules/wtf_wikipedia/src/fetch.js:36:38)

root cause is the following check:

  var lookup = 'titles';
  if (isNumber.test(title) && title.length > 3) {
    lookup = 'curid';
  }

possible fix… hmm…

Object.prototype.toString.call(title) === '[object Number]'

would mean, I have to pass a real number as first argument.

wtf(1111111111, 'de');

? new option property?

wtf('2018', 'de', {
  pageId: true
});

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
spencermountaincommented, Sep 21, 2018

hey, sorry for missing this. Been getting swamped. hah, yeah- this looks like it’s just me being sloppy. How would you feel about it listening to typeof, so that '1984' returns the title, but 1984 returns the pageid. I like that over using another config param. that cool?

0reactions
spencermountaincommented, May 27, 2020

@skipjack yep, that sounds plausible. i agree prs welcome

Read more comments on GitHub >

github_iconTop Results From Across the Web

Throws error: Cannot read property 'pages' of undefined #91
Describe the bug Running next-sitemap in a postbuild script errors out with the error Cannot read 'pages' of undefined .
Read more >
TypeError: Cannot read property 'Page' of undefined
I resolved this error by making sure that the option to transfer the context of execution as the first parameter was ticked. enter...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError : Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an...
Read more >
Cannot read property 'pages' of undefined
Cannot read property 'pages' of undefined. ‎03-06-2018 05:58 PM. Hello, I have a fresh Windows 10 system with Power Bi desktop 64 bit....
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