Error in Flask App deployment using Zappa

1.4k views Asked by At

I am very new in zappa. Currently I am trying to deploy my flask project using zappa.

While deploying my Flask app I get this error

Traceback (most recent call last):
  File "c:\users\tanvir\virenvfordeployment\env\lib\site-packages\zappa\cli.py", line 1847, in handle
    sys.exit(cli.handle())

  File "c:\users\tanvir\virenvfordeployment\env\lib\site-packages\zappa\cli.py", line 345, in handle
    self.dispatch_command(self.command, environment)

  File "c:\users\tanvir\virenvfordeployment\env\lib\site-packages\zappa\cli.py", line 379, in dispatch_command
    self.update()

  File "c:\users\tanvir\virenvfordeployment\env\lib\site-packages\zappa\cli.py", line 605, in update
    endpoint_url = self.deploy_api_gateway(api_id)

  File "c:\users\tanvir\virenvfordeployment\env\lib\site-packages\zappa\cli.py", line 1816, in deploy_api_gateway
    cloudwatch_metrics_enabled=self.zappa_settings[self.api_stage].get('cloudwatch_metrics_enabled', False),

  File "c:\users\tanvir\virenvfordeployment\env\lib\site-packages\zappa\zappa.py", line 1014, in deploy_api_gateway
    variables=variables or {}

  File "c:\users\tanvir\virenvfordeployment\env\lib\site-packages\botocore\client.py", line 251, in _api_call
    return self._make_api_call(operation_name, kwargs)

  File "c:\users\tanvir\virenvfordeployment\env\lib\site-packages\botocore\client.py", line 513, in _make_api_call
    api_params, operation_model, context=request_context)

  File "c:\users\tanvir\virenvfordeployment\env\lib\site-packages\botocore\client.py", line 566, in _convert_to_request_dict
    api_params, operation_model)

  File "c:\users\tanvir\virenvfordeployment\env\lib\site-packages\botocore\validate.py", line 270, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())

ParamValidationError: Parameter validation failed:
Invalid type for parameter restApiId, value: None, type: <type 'NoneType'>, valid types: <type 'basestring'>

Does anyone know why this error is coming or how I can resolve this?

2

There are 2 answers

0
Maurice On

I don't know much about zappa, but the error message clearly states your problem:

Invalid type for parameter restApiId, value: None, type: <type 'NoneType'>, valid types: <type 'basestring'>

It seems to me that you haven't set the parameter restApiId, which should contain a value of type basestring. I'm not sure what that parameter is about, but it seems to have to do something with the AWS-CLI.

0
Chuck LaPress On

In your aws cli be sure you are utilizing the IAM that you created for the zappa function, then follow the aws configure q&a for access key, secret key and region. I would suggest that you follow this very helpful tutotial that takes it step by step: https://developer.amazon.com/blogs/post/8e8ad73a-99e9-4c0f-a7b3-60f92287b0bf/new-alexa-tutorial-deploy-flask-ask-skills-to-aws-lambda-with-zappa I really hope this is helpful.