0

I'm currently getting into developing alexa-skills. This is in fact the 1st time I'm trying this and I kinda works out good so far. However, I stumbled upon a problem which seems to be wide-spreaded but I couldn't find an answer how to solve it.

First things first: I started this skill by following a tutorial. It might be that this tutorial is outdated and therefore this error appears.

I created a skill from the scratch and it works to the part where the LaunchRequest is invoked:

enter image description here

As you can see, I get my response as expected. (works on the test-environment as well as on alexa itself). Now, when try to call an IntentRequest, I just get the error-message:

The remote endpoint could not be called, or the response it returned was invalid.

enter image description here

As I can tell from the picture / request, the correct intent-request is called (in my case getSubscriberCount ) - And this is the point where I have no idea anymore on how to resolve this problem.

To keep things short, this here is the JS-part for the Intent:

case "IntentRequest": // Intent Request console.log(INTENT REQUEST)

    switch(event.request.intent.name) {
        case "GetSubscriberCount":
            var endpoint = "my url"
            var body = ""
            https.get(endpoint, (response) => {
                response.on('data', (chunk) => { body += chunk })
    response.on('end', () => {
        var data = JSON.parse(body)
        var subscriberCount = data.items[0].statistics.subscriberCount
        context.succeed(
        generateResponse(
            buildSpeechletResponse(`Du hast momentan ${subscriberCount} Abonnenten`, true),
            {}
        )
    )

And this is causing my problems. To test what exactly is wrong, I tried the following:

  • Called the endpoint in my browser --> Correct output
  • Adjusted the "response" to the minimum to see if that works --> didn't work
  • Checked several sources related to this error --> didn't help either

I saw some approaches to get rid of this, since this seems to be a common issue, but I got lost. Someone mentioned an environment variable, which I couldn't put my hands on. Another one suggested to run the JSON request manually, which I tried, but leading to the same error.

Hopefully you can help me out here.

DasSaffe
  • 2,080
  • 1
  • 28
  • 67

1 Answers1

0

Assuming you AWS lambda, it might be because you didn't create your response right or your AWS lambda function had a error.

Raymond
  • 396
  • 4
  • 21