jovotech / jovo-framework

🔈 The React for Voice and Chat: Build Apps for Alexa, Messenger, Instagram, the Web, and more
https://www.jovo.tech
Apache License 2.0
1.67k stars 310 forks source link

Alexa's submission process fails due to missing apiEndpoint on dummy request #260

Closed shmatul closed 5 years ago

shmatul commented 5 years ago

I'm submitting a...

Alexa's submission process runs several basic functionality test when submitting a skill, among other things it checks if the launch intent returns a valid response. Alexa's submission process requests serve a different kind of object rather than when using regular devices / simulator, and it's missing the apiEndpoint property (jovo.platform.request.context.System.apiEndpoint === undefined).

Current Behavior

When outputting a progressiveResponse or any other apiEndpoint dependent functions in the launch intent of a skill it will fail Alaxa's subbmisions automated tests. jovo-framework/lib/platforms/alexaSkill/alexaSkill.js looks for the apiEndpoint and tries to trim it:

 hostname: this.request.getApiEndpoint().substr(8), // remove https:// 

Expected Behavior

Until (or if) will get fixed by Amazon, jovo request should fallback apiEndpoint property to 'https://api.amazonalexa.com'.

Error log

2018-10-07T08:13:35.420Z    e3189c42-ca08-11e8-b0c9-6dc90c997f19    HelloWorldIntent
2018-10-07T08:13:35.421Z    e3189c42-ca08-11e8-b0c9-6dc90c997f19    handleLambda err TypeError: Cannot read property 'substr' of undefined
    at AlexaSkill.progressiveResponse (/var/task/node_modules/jovo-framework/lib/platforms/alexaSkill/alexaSkill.js:1154:52)

Your Environment

aswetlow commented 5 years ago

Hey @shmatul Good point! Would you like to make a pull request?

shmatul commented 5 years ago

@aswetlow sure. I'll try to make one that you'll accept :)

jankoenig commented 5 years ago

Thanks @shmatul !