tlovett1 / alexa-skill-test

Test Alexa skills through a local Express server.
43 stars 9 forks source link

Failure when application IDs don't match #3

Closed cosinekitty closed 6 years ago

cosinekitty commented 7 years ago

Hi, great tool, but I'm running into an issue. Now that I figured out how to correctly set my application ID:

https://forums.developer.amazon.com/questions/36825/how-to-fix-warning-application-id-is-not-set.html

I'm getting an error when I try to test locally:

info: ------
info: START RequestId: 8041c2be-ed30-b681-e106-359861d4d40d
The applicationIds don't match: amzn1.echo-sdk-ams.app.000000-d0ed-0000-ad00-000000d00ebe and amzn1.ask.skill.<redacted>
error: FAILING!!
info: END
error: Error
error: ------

The <redacted> part in the log above is to hide my actual skill ID. In http://localhost:3000, I tried to edit the request JSON but that box is read-only. How can I configure the request to have the correct application ID?

Thanks!

tlovett1 commented 7 years ago

So wherever you are setting your appId you should do something like this:

if ('undefined' === typeof process.env.DEBUG) {
    alexa.appId = '...';
}

Alexa Skill Test will automatically set debug. I'll make sure to add this to the README.

cosinekitty commented 7 years ago

Thank you, Taylor. That does help. However, the reason I got into this problem was because I kept noticing this in the output:

Warning: Application ID is not set

It turns out the Amazon sample code has a mistake in it where I was setting alexa.APP_ID instead of alexa.appId. See here:

https://forums.developer.amazon.com/questions/36825/how-to-fix-warning-application-id-is-not-set.html

So as soon as I fixed that, I ran into this problem. With your suggested change, the warning is back when I use alexa-skill-test. I would recommend the following:

  1. Add an extra box in http://localhost:3000 where we can enter the actual app ID for our skill.
  2. Include that app ID in the generated JSON request.
  3. Persist the app ID in localStorage so the developer doesn't have to paste it in every time they test.

That way we can avoid the warning plus we don't have to change our code to accommodate the tool.

I would be willing to create a pull request for this if you agree it would be a useful approach.

tlovett1 commented 7 years ago

I feel like it would be pretty annoying to have to input an app ID. Just not setting the app ID in dev seems much easier. Would love to hear others thoughts.

cosinekitty commented 7 years ago

I thought about this some more. Maybe this is simpler: how hard would it be to allow us to edit the request JSON directly before it is submitted to the skill under test? In other words, make the box that shows the request JSON be editable instead of read-only? Then we can change the app ID if we want, or make any other changes to see how our skill reacts.

tlovett1 commented 7 years ago

That capability should actually be in the latest version if you update :)

cosinekitty commented 7 years ago

I just upgraded and yes, it works great! Editing the request JSON is handy for adding an accessToken for account linking also. Thanks for providing this tool. It is saving me a huge amount of time.