Skip to content

Using non-alphanumerics in app name causes opaque errors #2

@goodmike

Description

@goodmike

Hello, I'm working through your excellent book-in-progress, Building Voice-Enabled Apps with Alexa, and I encountered a strange error when working through the 'dragonhunt' skill in Chapter 2. When I went to run it with node index, I got this unhelpful error back in the terminal window:

/node_modules/chatskills/lib/chatskills.js:24
        this.sessions[this.sessionId].slots[key] = value;
                                     ^

TypeError: Cannot read property 'slots' of undefined

That's JavaScript for you, right?

After digging around a bit, I discovered I had named my skill dragon_hunt, with an underscore, and this had caused the regular expression in use in ChatSkillsManager#session to fail to match the input. The regex is defined thus: new RegExp(this.id + '[,\\-\\!\\? ]+ask ([a-zA-Z0-9]+)[,\\. ](.*)', 'i').

So, is the exclusion of non-alphanumerics from skill name intentional, or just accidental? If it's intentional, or seems like a good idea, then I could submit a pull request to check skill names at the beginning of execution against that requirement and throw an error if the skill name isn't going to fly. Otherwise, I could submit a PR expanding the characters allowed in the regex and probably also checking against that, since there will be some characters we don't want in the skill name. Either way, I'd be happy to contribute to your very helpful project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions