just wondering if someone can help me with this issue: I am trying to run a code in a lambda function and I have created a layer for this using a docker to create the needed libs:

# Use an official Amazon w/python3 FROM public.ecr.aws/lambda/python:3.9 # Create and activate a virtual environment RUN python3.9 -m venv /app/venv ENV PATH="/app/venv/bin:$PATH" # Install required packages COPY . . RUN pip3 install --upgrade pip RUN pip3 install --platform manylinux2014_x86_64 --target ./venv/lib/python3.9/site-packages --python-version 3.9 --only-binary=:all:  -r requirements.txt 
when i upload the function code and test it i am receiving this error: [ERROR] Runtime.ImportModuleError: Unable to import module 'google_conversion_lambda': google-ads Traceback (most recent call last):INIT_REPORT Init Duration: 3853.19 ms Phase: init Status: error   Error Type: Runtime.Unknown [ERROR] Runtime.ImportModuleError: Unable to import module 'google_conversion_lambda': google-ads Traceback (most recent call last):INIT_REPORT Init Duration: 25715.69 ms    Phase: invoke   Status: error   Error Type: Runtime.Unknown 

the import is coded like this:

from google.ads.googleads.client import GoogleAdsClient 

its is weird and I am running out of ideas to try. Any suggestions or other leads that I can try?

I already tried:

  1. On the code Zip file include all the google libraries needed along with the function.
  2. Rebuilding as a layer, with other building methods using the docker.

Both shows the same results.

EDIT: Just to let you know the issue here is that I was zipping the files on a windows environment and even the zipping process should happen inside the docker environment (Linux) after that we are good to export the zip file and update the layer.

Tag:google-ads-api, amazon-web-services, aws-lambda

Add a new comment.