I am using the Python ASK SDK with Python 3.7 for a generic web service hosting a custom Alexa skill. I am doing my testing using an Echo Dot device.
In my web service I create an instance of WebserviceSkillHandler, then I manage intent dispatching using its verify_request_and_dispatch method.
Everything works fine except when I instantiate WebserviceSkillHandler requesting to verify the signature:
webservice_handler = WebserviceSkillHandler(skill=sb.create(), verify_signature=True)
In this case trying to dispatch an intent from Alexa's request (headers and body unchanged):
response = webservice_handler.verify_request_and_dispatch( http_request_headers=request.headers, http_request_body=request.body)
gives the following error:
AttributeError: 'bytes' object has no attribute 'encode' in ask_sdk_webservice_support/verifier.py", line 363, in _valid_request_body request_env_bytes =serialized_request_env.encode(CHARACTER_ENCODING)
I am getting the error running my web service both locally (with ngrok) and remotely (on EC2), with installed certificates from an Amazon trusted certificate authority or self-signed.
Anybody experienced a similar situation?