'Alexa SmartHome Skills : Issue with device discovery

I have written an Alexa smart home skills.

When I try to discover the device using the Alexa test or from the mobile app, the lambda is triggered.

The lambda is getting successfully executed, but I get below error in App or test in Alexa console.

I couldn't find any new Smart Home devices. If you’ve ‎n't already, please enable the smart home skill for your device from the Alexa App.

What could be the possible issue?

Since the lambda is getting successfully executed, I don't think there is any issue with language (English(IN)) or AWS region (EU-WEST-1) , where the lambda is deployed.

I didn't see any logs on Alexa developer console

Any pointers?

Response from Lambda function -

header =

    { 
namespace: 'Alexa.Discovery',
    name: 'Discover.Response',
    payloadVersion: '3',
    messageId: '785f0173-6ddb-41d8-a785-de7159c7f7ca' 
}

payload =

{
    "endpoints": [
        {
            "endpointId": "d4b87cbe6c8e490493733f260b8c2c25",
            "friendlyName": "Kitchen",
            "description": "Demo",
            "manufacturerName": "Man1",
            "displayCategories": [
                "LIGHT"
            ],
            "cookie": {
                "owner": "Owner1"
            },
            "capabilities": [
                {
                    "type": "AlexaInterface",
                    "version": "3",
                    "interface": "Alexa"
                },
                {
                    "type": "AlexaInterface",
                    "version": "3",
                    "interface": "Alexa.PowerController",
                    "properties": {
                        "supported": [
                            {
                                "name": "powerState"
                            }
                        ],
                        "proactivelyReported": true,
                        "retrievable": true
                    }
                },
                {
                    "type": "AlexaInterface",
                    "version": "3",
                    "interface": "Alexa.BrightnessController",
                    "properties": {
                        "supported": [
                            {
                                "name": "brightness"
                            }
                        ],
                        "proactivelyReported": true,
                        "retrievable": true
                    }
                }
            ]
        }
    ]
}

We are wrapping header and payload in the response event.

context.succeed({ event: { header: header, payload: payload } });



Solution 1:[1]

So far I haven't found a way to view the logs either.

I had the same problem and I realized that I was putting wrong values in some properties or schema entities like ids.

In the same way, another thing that solved me on some occasion was to place the scheme in the following way:

context.succeed({
  "event": {
    "header": {
      "namespace": "Alexa.Discovery",
      "name": "Discover.Response",
      "payloadVersion": "3",
      "messageId": header.messageId
    },
    "payload": {
      "endpoints": [
        {
          "endpointId": "demo_id",
          ...
          ,
          "cookie": {},
          "capabilities": [
            {
              "type": "AlexaInterface",
              "interface": "Alexa",
              "version": "3"
            },
            ...
          ]
        }
      ]
    }
  }
});

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Albert