zappa / Zappa

Serverless Python
https://zappa.ws/zappa
MIT License
3.33k stars 363 forks source link

When calling zappa deploy dev AttributeError: 'Template' object has no attribute 'add_description' #1016

Closed omar-enrique closed 3 years ago

omar-enrique commented 3 years ago

I'm trying to build and deploy a new Zappa app for the first time, and when I ran Zappa deploy I got the following error:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/zappa/cli.py", line 3422, in handle
    sys.exit(cli.handle())
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/zappa/cli.py", line 588, in handle
    self.dispatch_command(self.command, stage)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/zappa/cli.py", line 644, in dispatch_command
    self.vargs["docker_image_uri"],
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/zappa/cli.py", line 1194, in update
    endpoint_configuration=self.endpoint_configuration,
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/zappa/core.py", line 2417, in create_stack_template
    self.cf_template.add_description("Automatically generated with Zappa")
AttributeError: 'Template' object has no attribute 'add_description'

Context

I am running python 3.7.2 and am using a virtual environment. Zappa init ran just fine and I was able to generate a zappa_settings.json file.

Here is my pip freeze:

argcomplete==1.12.3
asgiref==3.4.1
boto3==1.18.6
botocore==1.21.6
certifi==2021.5.30
cfn-flip==1.2.3
charset-normalizer==2.0.3
click==8.0.1
Django==3.2.5
durationpy==0.5
future==0.18.2
hjson==3.0.2
idna==3.2
importlib-metadata==4.6.1
jmespath==0.10.0
kappa==0.6.0
pep517==0.11.0
pip-tools==6.2.0
placebo==0.9.0
python-dateutil==2.8.2
python-slugify==5.0.2
pytz==2021.1
PyYAML==5.4.1
requests==2.26.0
s3transfer==0.5.0
six==1.16.0
sqlparse==0.4.1
text-unidecode==1.3
toml==0.10.2
tomli==1.1.0
tqdm==4.61.2
troposphere==2.4.1
typing-extensions==3.10.0.0
urllib3==1.26.6
Werkzeug==0.16.1
wsgi-request-logger==0.4.6
zappa==0.53.0
zipp==3.5.0

Expected Behavior

Zappa should deploy correctly.

Actual Behavior

It looks like a lambda function is created for my Zappa project, but no API gateway is created, so it only gets so far in the deployment process before it fails, and the failure is the traceback as see above.

Your Environment

I am using OSX 11.2.3, and my zappa_settings.json file is:

{
    "dev": {
        "aws_region": "us-east-1",
        "django_settings": "scribox.settings",
        "profile_name": "default",
        "project_name": "django-lambda-i",
        "runtime": "python3.7",
        "s3_bucket": "MY_BUCKET"
    }
}
Yaronn44 commented 3 years ago

Duplicated issue : #999 #1001 #1013

omar-enrique commented 3 years ago

Thank you for the quick response. I see that there is a pull request in to resolve this issue, and it is currently under code review at #999.

The other two issues have been closed, but should not have been because this issue has still not been resolved. I believe this issue should stay open until #999 gets pulled to master.

programmingwithalex commented 3 years ago

I can confirm I am having the same issue on Windows 10 with zappa version 0.53.0 installed.

omar-enrique commented 3 years ago

Not sure when the #999 pull request is going to be reviewed, merged, and released, but for now to get myself unblocked, I manually went into the installed Zappa package I had in my Python modules, and manually edited the line that's breaking. The issue is that the troposphere 3.0.0 version replaces add_description with set_description, so I changed that function in line 2417 in zappa/core.py from add_description to set_description.

https://github.com/zappa/Zappa/blob/master/zappa/core.py#L2417

With that change my app is now deploying just fine.

gvisalli commented 3 years ago

I also have this problem with deploy.

Need this PR reviewed so I can proceed with using zappa for deploy.

121940kz commented 3 years ago

This is really still not fixed? Same issue.

banananeer commented 3 years ago

I just encountered this issue as well

121940kz commented 3 years ago

I just encountered this issue as well

omar-enrique has the solution above, if you need help finding the file in windows let me know. It depends on if you use a virtual environment or not, but his answer above got me working.

rafagan commented 3 years ago

Zappa is still under maintenance? How could a simply problem like that not be solved fast. Where's the compatibility with flask 2?