Ryan Grush
Ryan Grush

Reputation: 2138

Configuring AWS Lambda function with Zappa, unknown error

I have a Lambda function that will be used to essentially curl a web address every minute. In order to do that I'm using the python Requests library. The problem I'm running into is how do I install the package on AWS like I'm able to do locally.

I came across Zappa and it looks to be what I need but I'm having issues configuring it. I went through the install steps for zappa, downloaded the aws-cli and setup the aws api credentials. This is the error message I'm getting -

$ zappa deploy production
Calling deploy for stage production..
Downloading and installing dependencies..
Packaging project as zip.
Error: Your app_function value is not a modular path. It needs to be in the format `your_module.your_app_object`.

In my zappa_settings.json -

{
    "production": {
        "app_function": "something", 
        "aws_region": "us-east-1", 
        "profile_name": "default", 
        "project_name": "something", 
        "runtime": "python2.7", 
        "s3_bucket": "company-lambda",
        "lamda_handler": "app.lambda_handler"
    }
}

In that directory I have -

In app.py -

def lambda_handler(event, context):
   print('hello')

Upvotes: 1

Views: 1110

Answers (1)

jarmod
jarmod

Reputation: 78918

Zappa is primarily used to host Python WSGI apps on API Gateway and Lambda, so it's typically for migrating an existing Flask/Django app, and those would have app objects.

If you don't need that level of function, and simply want to include a few Python packages with your Lambda function, then simply include the packages in your uploaded ZIP file, per the AWS example that actually packages up requests, using:

pip install requests -t /path/to/project-dir

Upvotes: 1

Related Questions