Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Lambda Function Cant Find Module

I have a problem where my Lambda function wont find module rpds. I am trying to import it through a layer and it comes with jsonschema.

Jsonschema can get import and it works but rpds does not. I have followed the folder structure in my layer as i should but the only module it never seems to read is the rpds

{
  "errorMessage": "Unable to import module 'lambda_function': No module named 'rpds.rpds'",
  "errorType": "Runtime.ImportModuleError",
  "requestId": "440ad04f-6a04-4650-a4d5-44f06b65e2dc",
  "stackTrace": []
}

I tried two things. I tried to import the whole project into the lambda with a zip and i tried to import a layer. I found the layer worked better where it recognized jsonschema but not rpds.

like image 829
Happy123 Avatar asked Feb 27 '26 16:02

Happy123


1 Answers

The issue is with newer versions of jsonschema.

jsonschema 4.18.0 was released on July 6th (a few days ago at time of writing).

On my team, we use Pipfile to manage our dependencies for our Python lambdas. I had this:

[packages]
jsonschema = ">=4.17.3"

I switched it to this

[packages]
jsonschema = "==4.17.3"

and now it is working again.

The rpds dependency must have been added in 4.18.0. Strangely enough, adding rpds to my list of dependencies in the Pipfile did not solve this issue.

like image 145
Jake Avatar answered Mar 01 '26 05:03

Jake



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!