user5820327
user5820327

Reputation: 241

python-oracledb on AWS Lambda Windows issue

I have a task to connect to an AWS RDS Oracle server and retrieve information using lambda layer. I have been working on this issue for almost two days. I discovered a lightweight Oracle database installation called python-oracledb but haven't been able to resolve the problem. I need help.

I am using Windows on my local machine, and the Oracle RDS is on a Windows EC2 instance as well.

Here is the error I am encountering:

`
[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'oracledb'
Traceback (most recent call last)
RequestId: 87f11785-14c0-4a8c-8dbf-61be98995b82
REPORT RequestId: 87f11785-14c0-4a8c-8dbf-61be98995b82 Duration: 3.22 ms Billed Duration: 4 ms Memory Size: 128 MB Max Memory Used: 61 MB Init Duration: 255.42 ms
`

I have referred to both ChatGPT, stackoverflow and Oracle documentation on using oracle-db, but I keep encountering the same error. I also attempted to use cx_oracle with the Oracle client, but I faced errors and size limitations when uploading it as a Lambda layer.

Steps I have taken:

Created a directory for the lambda layer:

`mkdir lambda_layer
cd lambda_layer
mkdir python`

Installed the oracledb package:

`pip install oracledb -t ./python`

Created a zip file for the layer:

cd python
zip -r ../python_oracledb_layer.zip .

I uploaded the python_oracledb_layer.zip file and ensured I used Python 3.12, which was used for local compilation (I've also tried other runtime versions). However, I still encounter the same error.

enter image description here

oracledb folder enter image description here

Upvotes: 0

Views: 294

Answers (0)

Related Questions