How do we package algolia search python module

Lambda function not executing if we use algoliasearch python api import in handler. ‘Import failed exception’ displaying. How do we package lambda functions with algolia search api for python.

Do we require docker for this.

Hello @bijusadasivan.nair,

Could you give us more details regarding your error? Ideally, could you share some code that highlights the issue? Also, could you tell us if the error is happening outside of your lambda function?

Any additional information could help us investigate (Python API client version, running environment, etc.).

Hello @anthony.seure,

I am getting following error while deploying (using sls deploy)

Serverless: Installing requirements of requirements.txt in .serverless…

Error --------------------------------------------------

python3.6 not found! Try the pythonBin option.

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com

Your Environment Information -----------------------------
OS: win32
Node Version: 8.9.1
Serverless Version: 1.27.3

The above error is obtained when following .yml is used for deployment

Serverless .yml
service: we
provider:
name: aws
runtime: python3.6
stage: dev
region: us-east-2
memorySize: 128
functions:
hello:
handler: handler.hello
plugins:

  • serverless-python-requirements
    custom:
    pythonRequirements:
    dockerizePip: false

When we changed following in .yml file,

custom:
pythonRequirements:
dockerizePip: no-linux

Serverless: Installing requirements of requirements.txt in .serverless…
Serverless: Docker Image: lambci/lambda:build-python3.6

Error --------------------------------------------------

docker not found! Please install it.

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com

Your Environment Information -----------------------------
OS: win32
Node Version: 8.9.1
Serverless Version: 1.27.3

Python Code

hanhler.py

import json
from algoliasearch import algoliasearch
def hello(event, context):
body = {
“message”: “Go Serverless v1.0! Your function executed successfully!”,
“input”: event
}

response = {
    "statusCode": 200,
    "body": json.dumps(body)
}

return response

# Use this code if you don't use the http event with the LAMBDA-PROXY
# integration
"""
return {
    "message": "Go Serverless v1.0! Your function executed successfully!",
    "event": event
}
"""