Zappa icon indicating copy to clipboard operation
Zappa copied to clipboard

Flask_Ask 500 Internal error with Zappa

Open libert-xyz opened this issue 7 years ago • 14 comments

Context

Hi, I followed this tutorial to deploy an Alexa Skill with Zappa: video and I'm getting a 500 error

Expected Behavior

My skill should work from Alexa(works locally with ngrok)

Actual Behavior

Output from AWS API Gateway

"{u'message': u'An uncaught exception happened while servicing this request. You can investigate this with the zappa tail command.', u'traceback': ['Traceback (most recent call last):\\n', ' File \"/var/task/handler.py\", line 433, in handler\\n response = Response.from_app(self.wsgi_app, environ)\\n', ' File \"/tmp/pip-build-jW5QZX/Werkzeug/werkzeug/wrappers.py\", line 903, in from_app\\n', ' File \"/tmp/pip-build-jW5QZX/Werkzeug/werkzeug/wrappers.py\", line 57, in _run_wsgi_app\\n', ' File \"/tmp/pip-build-jW5QZX/Werkzeug/werkzeug/test.py\", line 884, in run_wsgi_app\\n', \"TypeError: 'NoneType' object is not callable\\n\"]}"

Steps to Reproduce

  1. source venv/bin/activate
  2. pip install flask_ask zappa
  3. zappa init / zappa deploy dev

Environment

  • Zappa version used: zappa==0.42.1
  • Operating System and Python version: Ubuntu / Python 2.7
  • pip freezeaniso8601==1.2.0 argcomplete==1.8.2 asn1crypto==0.22.0 base58==0.2.4 boto3==1.4.4 botocore==1.5.40 certifi==2017.4.17 cffi==1.10.0 chardet==3.0.4 click==6.7 cryptography==1.9 docutils==0.13.1 durationpy==0.4 enum34==1.1.6 Flask==0.12.1 Flask-Ask==0.9.3 future==0.16.0 futures==3.1.1 hjson==2.0.7 idna==2.5 ipaddress==1.0.18 itsdangerous==0.24 Jinja2==2.9.6 jmespath==0.9.3 kappa==0.6.0 lambda-packages==0.15.1 MarkupSafe==1.0 placebo==0.8.1 pycparser==2.17 pyOpenSSL==17.0.0 python-dateutil==2.6.0 python-slugify==1.2.4 PyYAML==3.12 requests==2.18.1 s3transfer==0.1.10 six==1.10.0 toml==0.9.2 tqdm==4.14.0 troposphere==1.9.4 Unidecode==0.4.20 urllib3==1.21.1 Werkzeug==0.12 wsgi-request-logger==0.4.6 zappa==0.42.1
  • zappa_settings.json
{
    "dev": {
        "app_function": "skill.app", 
        "profile_name": "default", 
        "s3_bucket": "zapa-XXXX"
    }
}

Any thoughts?

libert-xyz avatar Jun 16 '17 14:06 libert-xyz

Fix

setupstools problem, refer link

Fix it with

pip install packaging

libert-xyz avatar Jun 16 '17 22:06 libert-xyz

Hey there,

I've got identical behavior from the same tutorial, but pip install packaging did not work for me; pip check finds no broken requirements, but zappa tail outputs the following: No module named 'cryptography.hazmat.bindings._openssl': ModuleNotFoundError. It seems like this may be a typo, as the previous line successfully does "from cryptography.hazmat.bindings.openssl.binding import Binding", but I don't know where to go to fix the typo (I think it's possible the part that says _openssl should just say openssl). I've uninstalled and reinstalled cryptography as well as reinstalled pip but neither fixed the issue. Has anyone else had this problem?

hmc-cs-abaugus avatar Jun 21 '17 00:06 hmc-cs-abaugus

I had this issue last night with my lambda. Got super scared but I solved by deleting all *.pyc pycache folders and files. re-deploying my production and it came back up.

ghost avatar Jun 30 '17 13:06 ghost

Seeing a similar issue to the one listed above. From my cloudwatch logs No module named packaging.version: ImportError

Python 2.7 pip 9.0.1

pip freeze aniso8601==1.2.0 argcomplete==1.8.2 arrow==0.10.0 asn1crypto==0.22.0 base58==0.2.4 binaryornot==0.4.3 boto3==1.4.4 botocore==1.5.40 certifi==2017.4.17 cffi==1.10.0 chardet==3.0.4 click==6.7 cookiecutter==1.5.1 cryptography==1.9 docutils==0.13.1 durationpy==0.4 enum34==1.1.6 Flask==0.12.2 Flask-Ask==0.9.4 future==0.16.0 futures==3.1.1 hjson==2.0.7 idna==2.5 ipaddress==1.0.18 itsdangerous==0.24 Jinja2==2.9.6 jinja2-time==0.2.0 jmespath==0.9.3 kappa==0.6.0 lambda-packages==0.15.1 MarkupSafe==1.0 packaging==16.8 pkg-resources==0.0.0 placebo==0.8.1 poyo==0.4.1 pycparser==2.17 pyOpenSSL==17.0.0 pyparsing==2.2.0 python-dateutil==2.6.0 python-slugify==1.2.4 PyYAML==3.12 requests==2.18.1 s3transfer==0.1.10 six==1.10.0 toml==0.9.2 tqdm==4.14.0 troposphere==1.9.4 Unidecode==0.4.21 urllib3==1.21.1 Werkzeug==0.12.2 whichcraft==0.4.1 wsgi-request-logger==0.4.6 zappa==0.42.2 zappa_settings.json

{ "dev": { "app_function": "app.app", "aws_region": "eu-west-2", "s3_bucket": "zappa-xxxxxxxxx" } }

Any suggestions what this could be?

robarthur avatar Jul 04 '17 10:07 robarthur

@robarthur installing packaging solved the problem in my case

pip install packaging

libert-xyz avatar Jul 05 '17 14:07 libert-xyz

I'm having the same problem and pip install packaging didn't work for me. Any other solution that worked?

GeorgianaPetria avatar Aug 02 '17 14:08 GeorgianaPetria

Deleting all Compile python files pycache worked for me. Good luck

On Wed, Aug 2, 2017 at 10:17 AM GeorgianaPetria [email protected] wrote:

I'm having the same problem and pip install packaging didn't work for me. Any other solution that worked?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Miserlou/Zappa/issues/933#issuecomment-319686234, or mute the thread https://github.com/notifications/unsubscribe-auth/ATnWLUHonll_4yEKjpCXBWRtkgTmQeR7ks5sUIULgaJpZM4N8gih .

ghost avatar Aug 02 '17 14:08 ghost

When do you delete the python files? Before re-deploying?

I used removed all .pyc files in my virtual env find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf and then zappa update dev but it still doesn't work.

GeorgianaPetria avatar Aug 02 '17 14:08 GeorgianaPetria

Does that do it recursively? I do it before deploying production.

On Wed, Aug 2, 2017 at 10:32 AM GeorgianaPetria [email protected] wrote:

When do you delete the python files?

I used removed all .pyc files in my virtual env find . | grep -E "(pycache|.pyc|.pyo$)" | xargs rm -rf and then zappa update dev but it still doesn't work.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Miserlou/Zappa/issues/933#issuecomment-319690927, or mute the thread https://github.com/notifications/unsubscribe-auth/ATnWLf-8AJbgDmmwm_j6YeicNV3QAh3Eks5sUIiVgaJpZM4N8gih .

ghost avatar Aug 02 '17 14:08 ghost

Yes, it does it recursively, but unfortunately it's still not working.

Any idea how I can to narrow down the error? "{u'message': u'An uncaught exception happened while servicing this request. You can investigate this with the zappa tail command.', u'traceback': ['Traceback (most recent call last):\\n', ' File \"/var/task/handler.py\", line 434, in handler\\n response = Response.from_app(self.wsgi_app, environ)\\n', ' File \"/tmp/pip-build-0Sv96s/Werkzeug/werkzeug/wrappers.py\", line 903, in from_app\\n', ' File \"/tmp/pip-build-0Sv96s/Werkzeug/werkzeug/test.py\", line 884, in run_wsgi_app\\n', \"TypeError: 'NoneType' object is not callable\\n\"]}"

GeorgianaPetria avatar Aug 02 '17 14:08 GeorgianaPetria

I started a new project from scratch and got this issue. Are you still having problems?

ghost avatar Aug 20 '17 18:08 ghost

I have successfully deployed several Zappa projects but only recently encountered this error. I also noticed for the first time, Zappa creation required cloudformation privileges. Could it be something in a newer version? This was a clean project, clean deploy

RenegadeMaster avatar Sep 05 '17 14:09 RenegadeMaster

Having the same problem with Django...

variable avatar Sep 07 '17 20:09 variable

I am having the same problem with Apistar, its complaining about dependencies, that are there.

Arttii avatar Oct 06 '17 07:10 Arttii