Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rubygem and Node Package both return nil/null #54

Closed
Shwheelz opened this issue Jun 3, 2017 · 4 comments
Closed

Rubygem and Node Package both return nil/null #54

Shwheelz opened this issue Jun 3, 2017 · 4 comments
Labels

Comments

@Shwheelz
Copy link

Shwheelz commented Jun 3, 2017

I'm having this issue with both the Ruby and Node versions of oakdex. No matter what I call, I always just get null back.

oakdex

@Shwheelz
Copy link
Author

Shwheelz commented Jun 3, 2017

var oakdex = require('oakdex-pokedex');
oakdex.findPokemon(number, function(p) {
            console.log(p.names.en);
});
// cannot read property 'names' of undefined

@jalyna jalyna added the bug label Jun 9, 2017
jalyna added a commit that referenced this issue Jun 9, 2017
@jalyna
Copy link
Owner

jalyna commented Jun 9, 2017

@Shwheelz Please try again for the ruby gem (release 0.1.3). It should work now. Thanks for reporting the bug!

I will further investigate in the node package.

@Shwheelz
Copy link
Author

Shwheelz commented Jul 21, 2017

The rubygem is working great now, thanks! I'm still having trouble with the node package though. I'm trying to call within an Alexa skill that gives a Pokemon name, and the user has to guess one of the Pokemon's types. Because it's an Alexa skill, it's admittedly hard to debug. Here's the snippet that's throwing the error, as well as the stack trace below.

let prepareQuestions = function(pokemonList) {
    let questionList = [];
    for (let pokemon of pokemonList) {
        Oakdex.findPokemon(pokemon, function(p) {
            let types = p.types;      // This is the error line below (index.js:43:26)
            questionList.push({question: pokemon, answer: types})
        });
    }
    
    return questionList;
}

Here's the stack trace; perhaps it could be useful. I'll continue to poke around as I get time as well, and maybe we can solve this. I think your node package is really useful, and I'm hoping to get it to work so I can make Alexa skills with it in the future.

module initialization error: TypeError
    at /var/task/index.js:43:26
    at /var/task/node_modules/oakdex-pokedex/src/oakdex_pokedex.js:106:13
    at /var/task/node_modules/oakdex-pokedex/src/oakdex_pokedex.js:47:5
    at allByName (/var/task/node_modules/oakdex-pokedex/src/oakdex_pokedex.js:9:5)
    at pokemonById (/var/task/node_modules/oakdex-pokedex/src/oakdex_pokedex.js:43:3)
    at /var/task/node_modules/oakdex-pokedex/src/oakdex_pokedex.js:103:9
    at allByName (/var/task/node_modules/oakdex-pokedex/src/oakdex_pokedex.js:9:5)
    at Object.findPokemon (/var/task/node_modules/oakdex-pokedex/src/oakdex_pokedex.js:100:5)
    at prepareQuestions (/var/task/index.js:41:16)
    at Object.<anonymous> (/var/task/index.js:51:22)

@Shwheelz
Copy link
Author

It appears all your node packages are passing, so I'm going to close the issue until I have ample time to debug my own app. Thanks again for fixing the Rubygem though! Great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants