-1

I have a lambda function and I am using aws_lambda_powertools in it. Lambda function project structure is like below-

source->Folder
   - handler.py
libs
   - aws-lambda-powertools
   - aws-xray-sdk
   - other libs which aws-lambda-powertools need

handler.py
from libs.aws_lambda_powertools import Logger, Tracer

When I run the lambda, it gives me an error "No Module found aws_xray_sdk" even though the module(used by aws-powertools) is there under the libs folder.

Source of Tracer which I am using in my lambda. https://github.com/awslabs/aws-lambda-powertools-python/blob/f5d14e3279276192c6fed0907b84b1dfa23c7b3c/aws_lambda_powertools/tracing/tracer.py

Knot
  • 141
  • 13

2 Answers2

0

Sound like Python don't know where to look. An idea is to put __init__.py files in your directories so Python knows those are packages

JPDF
  • 66
  • 4
  • I already have __init__.py file under source and libs directory(double underscore is there in file name) – Knot Aug 06 '20 at 17:53
  • @Knot Have you seen https://github.com/amguerrero/py_aws_lambda_skeleton might give you some ideas – JPDF Aug 06 '20 at 17:55
0

Are you defining your LD_LIBRARY_PATH in your lambda environmental variables?

Markonick
  • 188
  • 1
  • 7