When using 'Sam local invoke'to invoke a lambda locally , which relies on a layer built locally as well, the function cannot find the module which is part of the layer.
I am getting the error "unable to import package" error while invoking my lambda locally using 'sam local invoke FUNCTIONNAME'. Those packages are already present in layer(zipped folder). Is their any way to test these lamdas locally which are having python dependency zipped into layer.
START RequestId: 083247f2-3011-428c-a529-50eba6d668f2 Version: $LATEST Unable to import module 'getnext': No module named 'apiconfig' END RequestId: 083247f2-3011-428c-a529-50eba6d668f2 REPORT RequestId: 083247f2-3011-428c-a529-50eba6d668f2 Duration: 12 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 19 MB
'apiconfig' module is already present in layer.zip
Expectation is all the layer modules should get downloaded at some temp location while doing 'sam local invoke' so that it can take all the packages and run the lamda, and hence i tried using --layer-cache-basedir DIRECTORY flag too but still getting the same error, although the docker file is getting generated at DIRECTORY path. Also,Even though i have not provided --skip-pull-image flag it is still showing requested to skip pull images. Added --force-image-build flag too error