I have an AWS Lambda function that uses oauth2client and SignedJwtAssertionCredentials.
I have installed my requirements locally (at the root) of my Lambda function directory.
requirements.txt
boto3==1.2.5
gspread==0.3.0
oauth2client==1.5.2
pyOpenSSL==0.15.1
pycrypto==2.6.1
My lambda function looks like:
import boto3
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
def lambda_handler(event, context):
dynamodb = boto3.resource('dynamodb')
scope = ['https://spreadsheets.google.com/feeds']
private_key = "!--some-private-key"
google_email = "some-email"
credentials = SignedJwtAssertionCredentials(google_email, private_key, scope)
gc = gspread.authorize(credentials)
However, when running this, I get the following stack trace:
{
"stackTrace": [
[
"/var/task/lambda_function.py",
20,
"lambda_handler",
"credentials = SignedJwtAssertionCredentials(google_email, private_key, scope)"
],
[
"/var/task/oauth2client/util.py",
140,
"positional_wrapper",
"return wrapped(*args, **kwargs)"
],
[
"/var/task/oauth2client/client.py",
1630,
"__init__",
"_RequireCryptoOrDie()"
],
[
"/var/task/oauth2client/client.py",
1581,
"_RequireCryptoOrDie",
"raise CryptoUnavailableError('No crypto library available')"
]
],
"errorType": "CryptoUnavailableError",
"errorMessage": "No crypto library available"
}
From everything I've read online, I am told that I need to install pyopenssl. However, I already have that installed and pycrypto.
Is there something I'm missing?