bespoken / virtual-alexa

:robot: Easily test and debug Alexa skills programmatically
https://bespoken.io
Apache License 2.0
112 stars 35 forks source link

AlexaSkill ID verification failed. #97

Closed westlakem closed 5 years ago

westlakem commented 5 years ago

I'm running into an issue where the AlexaSkill ID verification is failing in my application. Here is the stack

com.amazon.ask.exception.AskSdkException: AlexaSkill ID verification failed.
        at com.amazon.ask.CustomSkill.invoke(CustomSkill.java:64) ~[ask-sdk-core-2.9.1.jar:na]
        at com.amazon.ask.CustomSkill.invoke(CustomSkill.java:53) ~[ask-sdk-core-2.9.1.jar:na]
        at com.amazon.ask.servlet.SkillServlet.doPost(SkillServlet.java:106) ~[classes/:na]

here is my test code

const vax = require("virtual-alexa");

it('launches successfully', async (done) => {
  const alexa = vax.VirtualAlexa.Builder()
    .skillURL('http://127.0.0.1:8080/')
    .interactionModelFile('./interaction.json')
    .create();
  alexa.utter('ask me')
    .then((payload) => console.log(payload))
    .catch((error) => console.log('e', error));
  done();
});

I've also tried doing the .launch() instead of the utter and I get the same result.

jkelvie commented 5 years ago

To ensure the skillID is set correctly in the payload passed to your application, change your initial call like so:

const alexa = vax.VirtualAlexa.Builder()
    .skillURL('http://127.0.0.1:8080/')
    .applicationID("MY_APPLICATION_ID")
    .interactionModelFile('./interaction.json')
    .create();

API docs are here: https://bespoken.github.io/virtual-alexa/api/classes/virtualalexabuilder.html#applicationid

westlakem commented 5 years ago

That did it... thanks!