I have a AWS Lambda function that fetches data from an API and save the data on to the database using SQLAlchemy. Works well on the local machine but as I generate a time triggered AWS Lambda function, the below response is generated.
I have already created a Lambda layer with SQLAlchemy. I have done this in both the ways i.e., downloading the linux wheel file and pip install on to the target directory and zipping them to create the layer, both failed and created the above response.
Wondering if any one have come across such issue?
Response { "errorMessage": "Unable to import module 'lambda_function': cannot import name 'EventTarget' from 'sqlalchemy.event' (unknown location)", "errorType": "Runtime.ImportModuleError", "requestId": "9112b506-7124-44a9-b6bc-95e69ae64202", "stackTrace": [] }
Function Logs START RequestId: 9112b506-7124-44a9-b6bc-95e69ae64202 Version: $LATEST [ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': cannot import name 'EventTarget' from 'sqlalchemy.event' (unknown location) Traceback (most recent call last):END RequestId: 9112b506-7124-44a9-b6bc-95e69ae64202 REPORT RequestId: 9112b506-7124-44a9-b6bc-95e69ae64202 Duration: 1.33 ms Billed Duration: 2 ms Memory Size: 128 MB Max Memory Used: 41 MB Init Duration: 144.00 ms
Request ID 9112b506-7124-44a9-b6bc-95e69ae64202