cannot import name 'BaseRequest'

I am building a flask lambda application using AWS SAM and my requirements.txt file looks like follows requests contentful flask-lambda numpy Recently the flask lambda libraries were updated and since then i am getting the following error whenever i run the lambda function:

{"errorMessage": "Unable to import module 'app': cannot import name 'BaseRequest' from 'werkzeug.wrappers' (/var/task/werkzeug/wrappers/__init__.py)", "errorType": "Runtime.ImportModuleError", "requestId": "f6e80202-e6ca-4335-9b3c-f15b3a6496c1", "stackTrace": []}[ERROR] Runtime.ImportModuleError: Unable to import module 'app': cannot import name 'BaseRequest' from 'werkTraceback (most recent call last):/wrappers/__init__.py) 
2

2 Answers

I fixed it by downgrading the package to Werkzeug==2.0.3 in requirements.txt

pip install werkzeug --upgrade

then

pip install flask --upgrade

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like