1
votes

While trying to import simple-salesforce packages in lambda I'm getting this error Error message

{
  "errorMessage": "Unable to import module 'lambda_function': No module named 'simple_salesforce'",
  "errorType": "Runtime.ImportModuleError"
}

I tried zipping the packages in a Unix environment and upload it to s3 buckets before making a layer in lambda. But it's saying it can't import the module. Below are the steps used

virtualenv v-env

python3 -m venv v-env

pip install simple-salesforce

deactivate

cd v-env/lib/python3.7/site-packages

zip -r9 ${OLDPWD}/function_sf.zip .

aws s3 cp function_sf.zip s3://my_bucket/layer_library/

Need help with importing simple-salesforce in lambda.

1
please elaborate on your problem - soheshdoshi
I have added some more info. @soheshdoshi - Sudhakaran
can you try without layers to see if it works? - Horatiu Jeflea
Lambda is throwing the same error when tried that way also. @HoratiuJeflea - Sudhakaran

1 Answers

0
votes

Per simple-salesforce primary documentation:

basic Salesforce.com REST API client built for Python 2.6, 2.7, 3.3, 3.4, 3.5, and 3.6

Maybe try to downgrade your env to 3.6 and try from there.

Source: https://github.com/simple-salesforce/simple-salesforce