Skip to content

Unable to import module 'wsgi_handler': No module named 'werkzeug' #469

Open
@bibbycodes

Description

@bibbycodes

I keep getting this error in my AWS logs when trying to deploy using serverless:

Unable to import module 'wsgi_handler': No module named 'werkzeug'

It seems that the zip folder containing the app does not contain the right packages as specified in my requirements.txt and there is no .requirements folder either.

I have explicitly specified werkzeug in my requirements .txt and yet this package cannot be installed.

My serverless .yml:

service: serverless-flask
plugins:

  • serverless-python-requirements
  • serverless-wsgi
  • serverless-dynamodb-local
    custom:
    tableName: 'transactions-table-${self:provider.stage}'
    wsgi:
    app: app.app # entrypoint is app.app, which means the app object in the app.py module.
    packRequirements: false
    pythonRequirements:
    dockerizePip: true
    dynamodb:
    stages:
    • test
    • dev
      start:
      migrate: true

provider:
name: aws
runtime: python3.6
stage: dev
region: us-east-1
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
Resource:
- { "Fn::GetAtt": ["TransactionsDynamoDBTable", "Arn" ] }
environment:
TRANSACTIONS_TABLE: ${self:custom.tableName}

functions:
app:
handler: wsgi_handler.handler
events:
- http: ANY /
- http: 'ANY {proxy+}'
resources:
Resources:
TransactionsDynamoDBTable:
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
-
AttributeName: transactionId
AttributeType: S
-
AttributeName: timestamp
AttributeType: S
KeySchema:
-
AttributeName: transactionId
KeyType: HASH
-
AttributeName: timestamp
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:custom.tableName}
My requrements.txt :

boto3==1.11.17
botocore==1.14.17
Click==7.0
docutils==0.15.2
Flask==1.1.1
itsdangerous==1.1.0
Jinja2==2.11.1
jmespath==0.9.4
MarkupSafe==1.1.1
python-dateutil==2.8.1
s3transfer==0.3.3
six==1.14.0
urllib3==1.25.8
Werkzeug==1.0.0
Any ideas what I'm doing wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions