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.

TypeError: Cannot read property 'WildPokemon' of undefined

See original GitHub issue

I get this error after a successful login

macbookproloreto:PokemonGo-node-api admin$ node example.js 
[i] Logging with user: xxxx@gmail.com
[i] Logging with user: xxxx@gmail.com
[i] Received Google access token!
[i] Received Google access token!
[i] Received API Endpoint: https://pgorelease.nianticlabs.com/plfe/100/rpc
[i] Current location: Times Square
[i] lat/long/alt: : 40.759011 -73.9844722 0
[i] Received API Endpoint: https://pgorelease.nianticlabs.com/plfe/100/rpc
1[i] Current location: Times Square
1[i] lat/long/alt: : 40.759011 -73.9844722 0
[i] Logged in!
[i] Username: Ladalisa
[i] Poke Storage: 250
[i] Item Storage: 350
[i] Pokecoin: 0
[i] Stardust: 200
[i] Logged in!
1[i] Username: Ladalisa
1[i] Poke Storage: 250
1[i] Item Storage: 350
1[i] Pokecoin: 0
1[i] Stardust: 200
1[+] There is a Weedle at 200 meters
1[+] There is a Voltorb at 200 meters
1[+] There is a Pidgey at 200 meters
1[+] There is a Rattata at 200 meters
[+] There is a Weedle at 200 meters
[+] There is a Voltorb at 200 meters
[+] There is a Pidgey at 200 meters
[+] There is a Rattata at 200 meters
/PokemonGo-node-api/example.js:105
                for (var j = hb.cells[i].WildPokemon.length - 1; j >= 0; j--)
                                        ^

TypeError: Cannot read property 'WildPokemon' of undefined

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
andnpcommented, Jul 23, 2016

First I would advise against using the example.js exactly as written. If you do not intend to login with 2 unique accounts, you should get rid of the duplicated code and login only once.

Secondly, there is a bug on line 105 where i is defined as being outside the range of hb.cells. I can put up a PR later unless someone else beats me to it.

0reactions
andnpcommented, Jul 24, 2016

We should be able to close this now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pokemon API Uncaught TypeError: Cannot read property '0' of ...
When you try to access sprites[0] , sprites is undefined , since the data hasn't been loaded yet. one way to solve this...
Read more >
poke api cannot read properties of undefined - You.com
Pokemon Api: TypeError: Cannot read property 'type' of undefined ... If I put wildPokemon.name , I'll get the name of the pokemon, which...
Read more >
Cannot read properties of undefined' - JavaScript Debugging
JavaScript Tutorial. How To Fix 'Uncaught TypeError : Cannot read properties of undefined ' - JavaScript Debugging. 26K views 6 months ago.
Read more >
Cannot read property 'map' of undefined | by May Guo - Medium
I wanted to pull in all the Pokemon and display them in cards. I used useState to set my pokemons variable to an...
Read more >
Uncaught TypeError: Cannot read property 'find' of undefined
I am getting a TypeError, while it should not be as I believe I have the variables properly defined im creating a new...
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