1

I'm using amplify to push my lambda. When I run it locally via amplify mock function {functionName} it runs and behaves as expected. When I deploy using amplify push it successfully deploys. However when I attempt to run the lambda from the AWS lambda ui I get the following error message.

{
  "errorMessage": "Unable to import module 'index': No module named 'pydantic_core._pydantic_core'",
  "errorType": "Runtime.ImportModuleError",
  "stackTrace": []
}

My development machine is a mac using the M3 chip. Python is version 3.8.19. I'm stuck and thus far nothing I've been able to find online has resolved my issue.

1 Answer 1

0

I ended up having to remove supabase from the lambda itself and spin up a docker container to install a version of supabase with the appropriate wheel and create a zip file containing the dependencies.

Before zipping, the dependencies need to be in a file structure that follows this pattern: python/lib/python3.9/site-packages

Then I uploaded the zipped packages as a lambda layer. Which you can do by going to lambdas -> layers -> Add new. Then in the code tab for the relevant lambda you'll need to add the layer.

Hope this helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.