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

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.

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest