Alexa AWS lambda failing. "Missing directive" in logs

I’m trying to set up connection to Alexa using the Alexa integration. I’ve followed the official documentation and some video guides but they’re all quite out of date. It appears Amazon have changed their AWS and Alexa UIs.

I’ve successfully made the connection back to home assistant, and my devices can be seen in the response, but when I try and assign a command, the is a failure sending between Alexa and the AWS lambda, so nothing gets sent to homeassistant

I won’t post the logs just yet, as I’m not sure if any of it exposes my AWS details, but the homeassistant lambda copied from the guide says

    [ERROR] AssertionError: Malformatted request - missing directive
    Traceback (most recent call last):
      File "/var/task/lambda_function.py", line 37, in lambda_handler
        assert directive is not None, 'Malformatted request - missing directive'

I’ve looked at the JSON sent from Alexa to AWS and it definitely doesn’t include a “directive”, so I don’t know if I’ve configured the Alexa skill incorrectly, or if the published lambda is out of date. Does anyone have any insight?

Disclaimer, I am a developer, but not a web dev. So I have technical knowledge, don’t have issues with updating scripts, etc. but may be missing something obvious

PS. I know that I could use emulated hue or nabu casa, but as the documentation is outdated, I would like to get it working so that I can update the documentation for others to use

1 Like