Python lambdas unable to find layers, external dependencies #937
Replies: 1 comment 2 replies
|
Thanks for the detailed report; this is a bug in MiniStack, not in your setup. Your CDK configuration is correct. Root cause: when a layer was deployed through CloudFormation (which is what CDK uses under the hood), MiniStack's CloudFormation provisioner fetched the layer ZIP from S3 but never persisted the actual content. The bytes were used to calculate metadata such as code size and hashes, then discarded. The direct That's why you saw the split behavior:
Fix: the CloudFormation layer provisioner now stores the layer ZIP content, making CloudFormation/CDK-deployed layers behave the same as layers published through the Lambda API. I've also added a regression test that deploys a layer and function through CloudFormation and verifies that packages from the layer can be imported successfully at invocation time. The fix will be included in the next release. Thanks again for the clear reproduction steps and the kind words. Reports like this make MiniStack better. |
Uh oh!
There was an error while loading. Please reload this page.
When using any python lambda that's been deployed via CDK, using either
aws-cdk.aws-lambda-python-alpha==2.252.0a0With the format
For the functions
and
for the layers
Or with our previous manual implementation
and layer:
Any time a lambda is invoked, we receive an error such as
{ "errorMessage": "Worker init failed: No module named 'pydantic'", "errorType": "RuntimeError" }for any package that is included in the requirements.txt, as well as for any imports from layers (such as,
Worker init failed: No module named 'layerName')Is there full support for Python Lambdas and Layers in Ministack, or is there some problem with our setup? These lambdas all perform as expected when deployed to AWS so it's been a bit of a headscratcher as to why the layers and packages arent available when deployed to ministack, as the layers are showing up when
awslocal lambda list-layersis called:Any information or guidance is very much appreciated, and once again thank you for all your hard work on Ministack!
All reactions