RamjiP / alexa-skill-sdk-for-azure-function

Alexa skill sdk for Node.js for azure function
5 stars 2 forks source link

Handlers are not defined/set and there by leading to error #3

Closed lasarvit closed 6 years ago

lasarvit commented 6 years ago

After installing this node module to the Azure Function Apps and while calling the function that has the same code as given in the usage section(https://github.com/RamjiP/alexa-skill-sdk-for-azure-function), I'm getting below error... ..................................................... mscorlib: TypeError: Cannot read property 'push' of null at Object.lambdaStyleHandler (D:\home\site\wwwroot\node_modules\alexa-skill-sdk-for-azure-function\src\index.js:38:30) at D:\home\site\wwwroot\node_modules\alexa-skill-sdk-for-azure-function\src\index.js:51:16

The example in the usage section, set null value to the "handlers". This could be the cause for the above error. Could you please let me know how to handle this instance.

lasarvit commented 6 years ago

@kino3, @RamjiP - Did you had a chance to look into the issue reported above?

lasarvit commented 6 years ago

@RamjiP - Also posted my questions in microsoft forum. https://social.msdn.microsoft.com/Forums/en-US/864bc3b5-e43a-483e-8fbf-acf69ff50b28/azure-function-apps-for-alexa-skill-kit?forum=AzureFunctions. Waiting for your response...

kino3 commented 6 years ago

@lasarvit Hi. You should specify some handlers rather than null. like, handlers: [handlers, abcHandlers], Sample handlers can be shown at https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs I suppose this module is still a developing version, and also not an official module given by Microsoft.

lasarvit commented 6 years ago

@kino3 , Thanks for your response. I want to use Azure Function Apps instead of Amazon-Lambda. So this node modules, looks to me that it would serve my purpose. Since it became a show-stopper on my task, I reached out to Microsoft azure team as well for help.

As you told, I've added my handlers as an array. Earlier, I didn't used array and assigned directly like other elements . This could be cause of the issue :(.

Now with this change, I'm getting below error...... TypeError: context.fail is not a function at AlexaRequestEmitter.ValidateRequest (D:\home\site\wwwroot\node_modules\alexa-sdk\lib\alexa.js:186:28)

Could you please help on this.

kino3 commented 6 years ago

@lasarvit , I could help you if you give me some codes (hopefully, all of your Azure function). Also, are you familiar with alexa-skill development on Amazon-lambda? I think there is not so much difference between Amazon-lambda and azure-function.

lasarvit commented 6 years ago

@kino3 I've started working on Alexa skills 7-10 days back, and I'm quite familiar with Amazon-Lambda. Using Lamba, I'm able to implement some of the basics stuffs like calling restful API, find device/user location, get the value of slots and process the request accordingly etc. Due to client needs, I need to use MS Azure instead of Amazon-Lambda.

I'm trying to run the sample in Azure as given in this node module in usage section - https://github.com/RamjiP/alexa-skill-sdk-for-azure-function#usage.

I was trying to return a JSON in the format as seen in Service Response section in Alexa Skills Test tab, when we make a request and test from Alexa skills. This returned me null. I refactored my code and instead of JSON, I was calling this.emit(:ask or :tell, ""). This one worked well with yours/@RamjiP node modules.

This module is going be useful to any devlopers who what use Azure Function Apps instead of Amazon Lambda, like it did to me. @kino3 & @RamjiP Thank a lot!

Thanks Lasar Samuel