I\'m trying to begin developing a skill for alexa using flask-ask and ngrok in python. Following is my code:
from flask import Flask
from flask_ask import As
Ran into the same issue, you can fix it by downgrading cryptography to anything less than 2.2 for me.
pip install 'cryptography<2.2'
rpg711 gets all the credit (see comments the on original post)
Referring to this link helped me solve the problem. https://github.com/pyca/cryptography/issues/3489
Basically, by linking openssl in mac by $ brew link openssl
and installing cryptography==2.1.4, the problem was resolved.
I can confirm that this works with cryptography 2.1.4, not with 2.5 or 2.6 on Python 3.7 and Mac OS High Sierra. However on Mac OS there are other issues to get over first.
What I found is that installing crypotgraphy 2.1.4 ends with an error (as below). I hit this error at the very start of my flask-ask project and had to do a manual install of requirements before I started coding. When I finally started trying alexa, I got the same 500 error (as above) with cryptography 2.5 or 2.6. So reading that it has to be 2.1.4 I always got this error when trying to install that specific version:
#include <openssl/opensslv.h>
^~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
Having tried many things I tried the specific recommendation in this post (https://github.com/pyca/cryptography/issues/3489). Trying the export CPPFLAGS and LDFLAGS didn't seem to work, however the following did
pip3 install cryptography==2.1.4 --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include"
I am afraid I cannot say whether the things I tried before i.e. brew link openssl and setting the CPPFLAGS and LDFLAGS had an impact on the final result. I did not however do an update of openssl as in the post. I hope that helps, but I was not operating from a position of knowledge and was not sure whether I had the skills do a manual install of opsenssl as indicated further in the post.
I hope this helps as I had almost given up.
BTW: using ngrok's web interface/inspector I found really handy, i.e. being able to replay the amazon request time and time again was very, very handy for me as I made other errors before the cryptography issue.
On debian linux, attempting to downgrade the cryptography module with
pip install 'cryptography<2.2'
led to the errors of not being able to uninstall the old module (I think I had version 2.6.1). I uninstalled it manually by deleting the folders cryptography along with the *-.egg file within /usr/lib/python3/dist-packages.
Then, when I tried to install the older cryptography module, I again ran into an error "unable to build wheel" because I was missing some headers. According to the cryptography module docs Once I ran,
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
I was then finally able to install cryptography module version 2.1.4, and my alexa skill worked properly.