Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Alexa/Echo: AWS/Lambda config of myCQCHandler test fails
#1
Hello, 

As expected, Amazon has made some changes to both the AWS/Lambda (JS handler) & Developer Console (Alexa Skills) screens since the help documentation was written, including help from prior forum posts.  So I did my best to configure both areas, but Alexa skill testing failed under the Service Simulator using the Utterance...set Volume.  The response I get back is....The remote endpoint could not be called, or the response it returned was invalid.  Note: using the "arn" from Lamda to point new skill in console correctly to handler/JS and pasted the CQC Echo & CQC Echo Skills support files as noted in help doc.

Next, I tried to test the CQCHandler in AWS/Lambda, and fails w/ message:
{
 "errorMessage": "Exception: TypeError: Cannot read property 'application' of undefined"
}


The path to test handler above is: Action, Configure Test Event, Sample Event Template, Alexa Smart Home Discovery.
However, if I use these two Sample Event Templates, Alexa Start Session & End Session, it passes these two tests.  All other Sample Event Templates yield a failure message.

In configuration, I selected Runtime as Node js 4.3,  index.handler, & lambda_basic_execution. Not sure I pasted JS properly in code entry:

CODE Entry:

exports.handler = (event, context, callback) => {

    // TODO implement

    callback(null, 'Hello from Lambda');

};

//

//  Adjust these values to your specific system

//

//      HTTPType is either http or https. The latter is MUCH preferred,

//      but it requires that you have a registered security certificate

//      for your web server and configure the CQC web server to use it.

//

//      The IdKey is just a value that you will configure on the CQC

//      side, to help make sure you are getting a legitimate call from

//      your own Amazon account. Keep in mind though that, if you don't

//      use http, it's sent in the open and anyone could grab it and use it.

//

// The TarAddr and TarPort are your public address and the HTTP or

// HTTPS port of the web server (usually 80 and 443, but you whatever

// you set up when you installed CQC.)

//

var CQC_TarAddr = "1.2.3.4";

var CQC_TarPort = "80";

var CQC_HTTPType = "http";

var CQC_IdKey = "ABCDEF";





//

// Route the incoming request based on type (LaunchRequest, IntentRequest,
// etc.) The JSON body of the request is provided in the event parameter.
etc, etc.,,,============================================================.

BTW: I'm a newbie to CQC and just loaded the product a few days ago to evaluate a purchase w/ my existing HA/HomeTheater; i.e., ElkM1Gold/VantageControls (In-Fusion).  I'm not a programmer (hardware guy), but experienced using design tool/programming and GUI touchscreen development from Vantage (Q-link/Infusion), including Elk M1 programming and setting up rules, etc.  So please be gentle!   I can attached screens or logs if needed.

thanks, Ken
Reply
#2
If I'm reading this right, this isn't a problem. To actually test it, you'd have to create a test JSON input of the sort that CQC uses. None of the sample test inputs that their thingy spits is the correct format, so it would fail. So I'd say go ahead and try an end to end test and see how that goes. If that isn't being happy, let us know and we can dig deeper.

To start I'll dig back into it and figure out the correct format for some test content so that you can do the AWS level testing.
Dean Roddey
Software Geek Extraordinaire
Reply
#3
(09-26-2017, 10:54 AM)Dean Roddey Wrote: If I'm reading this right, this isn't a problem. To actually test it, you'd have to create a test JSON input of the sort that CQC uses. None of the sample test inputs that their thingy spits is the correct format, so it would fail. So I'd say go ahead and try an end to end test and see how that goes. If that isn't being happy, let us know and we can dig deeper.

To start I'll dig back into it and figure out the correct format for some test content so that you can do the AWS level testing.

Ok I'll try an E2E test, but I also thought running a test from the Service Simulator in Alexa Skills Console Test, using the Text Utterance from the pasted file, like "load a movie" would send a trigger to handler via arn and I should get back a response from Lamda handler that its talking to each other, correct?  Even though I don't have CQC setup, I should be able to have a new skill/Utterance i pasted in Interaction model contact the lambda handler and get positive acknowledgement back, or does handler need to go all the way to CQC to get positive ack back to skill console test?  I'll setup CQC now for E2E test.  

Thanks, Ken
Reply
#4
The test you do from AWS will have to go to CQC if you are invoking the Javascript, which you would be if you have set it up correctly, because the Javascript makes the call to CQC.

The test is basically simulating the Echo itself. In the real scenario it is:

Echo -> Skill -> Javascript handler -> CQC Web Server -> Your action

which then returns status and possibly text to speak, and then it goes back the other direction:

Your Action -> CQC Web Server -> Javascript -> Skill -> Echo

So really the only thing that skill test from AWS leaves out is the Echo at each end. The rest of it is still all happening.
Dean Roddey
Software Geek Extraordinaire
Reply
#5
(09-26-2017, 11:46 AM)Dean Roddey Wrote: The test you do from AWS will have to go to CQC if you are invoking the Javascript, which you would be if you have set it up correctly, because the Javascript makes the call to CQC.

The test is basically simulating the Echo itself. In the real scenario it is:

Echo -> Skill -> Javascript handler -> CQC Web Server -> Your action

which then returns status and possibly text to speak, and then it goes back the other direction:

Your Action -> CQC Web Server -> Javascript -> Skill -> Echo

So really the only thing that skill test from AWS leaves out is the Echo at each end. The rest of it is still all happening.

Understand ur flow diagram above, makes sense.  Working on CQC configuration to test.  Thanks, Ken
Reply
#6
It works once you attached the CQC Web Server into the end-to-end thread, and make sure the host running the CQC Web Server has port 20 "open" which is the default on installation!!!!  Took a day to figure out how to get this open, due to various firewalls, port forwarding issues, and double NAT issue w/ CableModem vs Home Router.

Other key lesson:
Make sure when creating a new account on Development Console for Amazon Alexa to develop the new skill, you use the same email and password when you loaded the Alexa Application.  Otherwise you will not find the CQC new skill developed in the Alexa App under "Your Skills".

thanks, Ken
Reply
#7
You meant port 80, right? The default HTTP port is 80, which the CQC web server should use unless you changed it.
Dean Roddey
Software Geek Extraordinaire
Reply
#8
(09-27-2017, 05:33 PM)Dean Roddey Wrote: You meant port 80, right? The default HTTP port is 80, which the CQC web server should use unless you changed it.

Correct, I mean't to say Port 80, the HTTP socket!    Sorry...  Thanks for ur help. Ken
Reply
#9
They also have their IAM system, which lets you create other user accounts for working online or using to access skills and such, so that you don't have to expose the master account.
Dean Roddey
Software Geek Extraordinaire
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  New Amazon Echo Support Dean Roddey 586 53,536 05-16-2017, 03:16 PM
Last Post: potts.mike
  Test my new web site concept Dean Roddey 35 3,819 05-06-2017, 11:45 AM
Last Post: Dean Roddey
  SOLVED: Media System Config Issue agarden 3 588 04-29-2017, 07:25 AM
Last Post: agarden
  Alexa comming to the iPhone! pjgregory 5 671 03-17-2017, 10:05 AM
Last Post: Dean Roddey
  Amazon email re Alexa interface? Ron Haley 5 738 03-14-2017, 02:40 PM
Last Post: Dean Roddey
  Querying Garade Door w/ Echo rbejr 32 3,179 01-28-2017, 11:08 AM
Last Post: rbejr
  Echo Config file issues rbejr 14 1,713 01-16-2017, 10:05 PM
Last Post: rbejr
  Test out our new forum Dean Roddey 59 6,348 01-05-2017, 08:41 PM
Last Post: Dean Roddey
  Google Home Integration using Amazon Echo Approach? Jnetto 4 1,103 12-21-2016, 02:04 PM
Last Post: Jnetto
  Bug with the Echo and nested global actions? dlmorgan999 2 661 12-18-2016, 01:07 PM
Last Post: dlmorgan999

Forum Jump:


Users browsing this thread: 1 Guest(s)