Miserlou / Zappa

Serverless Python
https://blog.zappa.io/
MIT License
11.89k stars 1.2k forks source link

Zappa certify raises ParamValidationError #1611

Open FlorisHoogenboom opened 5 years ago

FlorisHoogenboom commented 5 years ago

While upgrading our internal Django application I also decided to upgrade Zappa from 0.45.1 to 0.46.1 and botocore from 1.12.0 to 1.12.4. However, when running zappa certify env with the new versions I run into a botocore error.

I'm using ACM to manage certificates with an internal root CA. The deployment using the older versions mentioned above but after upgrading I run into the error below.

Expected Behavior

Zappa should retrieve and use the certificate from ACM

Actual Behavior

The following error is raised:

Calling certify for stage fon..
Certifying domain ████████████████████████████████████████████████████████.
  0%|          | 0.00/1.63K [00:00<?, ?B/s]100%|??????????????????????????????| 1.63K/1.63K [00:00<00:00, 76.8KB/s]Traceback (most recent call last):
  File "/data/jenkins/workspace/Deploy/Deploy/deploy-45315/zappa_schema_store/lib/python3.6/site-packages/zappa/cli.py", line 2693, in handle
    sys.exit(cli.handle())
  File "/data/jenkins/workspace/Deploy/Deploy/deploy-45315/zappa_schema_store/lib/python3.6/site-packages/zappa/cli.py", line 504, in handle
    self.dispatch_command(self.command, stage)
  File "/data/jenkins/workspace/Deploy/Deploy/deploy-45315/zappa_schema_store/lib/python3.6/site-packages/zappa/cli.py", line 611, in dispatch_command
    manual=self.vargs['manual']
  File "/data/jenkins/workspace/Deploy/Deploy/deploy-45315/zappa_schema_store/lib/python3.6/site-packages/zappa/cli.py", line 1861, in certify
    base_path=base_path
  File "/data/jenkins/workspace/Deploy/Deploy/deploy-45315/zappa_schema_store/lib/python3.6/site-packages/zappa/core.py", line 2153, in update_domain_name
    self.update_domain_base_path_mapping(domain_name, lambda_name, stage, base_path)
  File "/data/jenkins/workspace/Deploy/Deploy/deploy-45315/zappa_schema_store/lib/python3.6/site-packages/zappa/core.py", line 2184, in update_domain_base_path_mapping
    "value" : base_path}
  File "/data/jenkins/workspace/Deploy/Deploy/deploy-45315/zappa_schema_store/lib/python3.6/site-packages/botocore/client.py", line 320, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/data/jenkins/workspace/Deploy/Deploy/deploy-45315/zappa_schema_store/lib/python3.6/site-packages/botocore/client.py", line 596, in _make_api_call
    api_params, operation_model, context=request_context)
  File "/data/jenkins/workspace/Deploy/Deploy/deploy-45315/zappa_schema_store/lib/python3.6/site-packages/botocore/client.py", line 632, in _convert_to_request_dict
    api_params, operation_model)
  File "/data/jenkins/workspace/Deploy/Deploy/deploy-45315/zappa_schema_store/lib/python3.6/site-packages/botocore/validate.py", line 291, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter patchOperations[0].value, value: None, type: <class 'NoneType'>, valid types: <class 'str'>
Updating domain name!
Oh no! An error occurred! :(

Steps to Reproduce

  1. Set up an environment with zappa==0.46.1 and botocore==1.12.4 and Python 3.6
  2. Try to deploy and certify using AWS ACM

Your Environment

FlorisHoogenboom commented 5 years ago

It seems this has something to do with the base_path setting in zappa_settings.json. Setting this to an empty string seems to resolve the problem.

qherreros commented 5 years ago

I just tried your fix with base_path, didn't work for me. I still get

Setting DNS challenge.. Waiting for DNS to propagate.. Deleting DNS challenge.. Updating domain name! Parameter validation failed: Invalid type for parameter patchOperations[0].value, value: None, type: <class 'NoneType'>, valid types: <class 'str'> Failed to generate or install certificate! :(

My dependencies argcomplete==1.9.3 base58==1.0.0 beautifulsoup4==4.6.3 boto3==1.9.14 botocore==1.12.14 certifi==2018.8.24 cfn-flip==1.0.3 chardet==3.0.4 Click==7.0 docutils==0.14 durationpy==0.5 Flask==1.0.2 future==0.16.0 hjson==3.0.1 idna==2.7 itsdangerous==0.24 Jinja2==2.10 jmespath==0.9.3 kappa==0.6.0 lambda-packages==0.20.0 MarkupSafe==1.0 placebo==0.8.2 python-dateutil==2.6.1 python-slugify==1.2.4 PyYAML==3.12 requests==2.19.1 s3transfer==0.1.13 six==1.11.0 toml==0.9.6 tqdm==4.19.1 troposphere==2.3.3 Unidecode==1.0.22 urllib3==1.23 Werkzeug==0.14.1 wsgi-request-logger==0.4.6 zappa==0.46.2

FlorisHoogenboom commented 5 years ago

Did you set it to "" or to null? I used the former.

qherreros commented 5 years ago

I did set it to "" also, with no success so far.