Search code examples
python-3.6aws-lambda-layerssimple-salesforce

Lambda function failing with /lib64/libc.so.6: version `GLIBC_2.18' not found


I am trying to create a layer of simple-salesforce (Python Library) in AWS lambda, and trying to use it (import it) from my python code. I am having windows machine.

Though I read that there might be issues due to compilation windows so I install ubuntu1804 from windows store and then went ahead with creating zip for lambda layers. (zip is created for python folder with structure "python/lib/python3.6/site-packages/......")

I am using Python 3.6. I went through few articles for this issue but could find any resolution. this Video helped me creating a layer for Pandas & requests in AWS successfully with minor tweaks in pip commands I used

sudo python3 -m pip install simple-salesforce -t build/python/lib/python3.6/site-packages

Exactly same process i used for Simple salesforce and I am getting below error is as below:

Unable to import module 'lambda_function': /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /opt/python/lib/python3.6/site-packages/cryptography/hazmat/bindings/_rust.abi3.so)

Edit: -- Another approach I tried using .whl though this was not giving above error but giving error as "request module not found" and when I add request module layer it gives error authlib not found. (request layers work fine if I comment salesforce related things. Even tried uploading as simple layer same authlib issue I got)

Edit : Lambda code I am using is as below

the code I am using is basic code which doesnt have any logic with empty imports

import json
import pandas as pd
import requests as req
from simple_salesforce.format import format_soql

def lambda_handler(event, context):
    #TODO

Solution

  • I changed my code to not use simple_salesforce library and work out all the logic with Requests ( using Salesforce REST APIs). This is not really ideal but I could get it working as I had some deliveries to meet.