Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'requestPath' when used with API Gateway #188

Closed
nineinchnick opened this issue Aug 3, 2021 · 3 comments
Closed

KeyError: 'requestPath' when used with API Gateway #188

nineinchnick opened this issue Aug 3, 2021 · 3 comments

Comments

@nineinchnick
Copy link

After upgrading to 2.0 I started getting these errors:

[ERROR] KeyError: 'requestPath'
Traceback (most recent call last):
  File "/var/task/wsgi_handler.py", line 106, in handler
    return serverless_wsgi.handle_request(wsgi_app, event, context)
  File "/var/task/serverless_wsgi.py", line 173, in handle_request
    return handle_lambda_integration(app, event, context)
  File "/var/task/serverless_wsgi.py", line 295, in handle_lambda_integration
    path_info = event["requestPath"]

The docs for API Gateway Lambda integration doesn't mention requestPath anywhere: https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html

Can this be related to changes in this condition? d7a6ca1#diff-73eb20b9aafd70929ffc3487ee8a7cff8dedce9a6dc588e2cef517137836a82cL171

My serverless.yaml file:

service: xxx

plugins:
  - serverless-python-requirements
  - serverless-wsgi
  - serverless-domain-manager
  - serverless-api-gateway-throttling
  - serverless-apigw-binary
custom:
  stage: ${opt:stage}
  wsgi:
    app: api.app
    packRequirements: false
    pythonBin: python3
  pythonRequirements:
    zip: true
    pythonBin: python3
  domains:
    prod: xxx
  customDomain:
    domainName: ${self:custom.domains.${opt:stage}}
    basePath: ''
    stage: ${self:provider.stage}
    createRoute53Record: true
  apiGatewayThrottling:
    maxRequestsPerSecond: 5
    maxConcurrentRequests: 10
  apigwBinary:
    types:
      - 'text/plain'
      - 'application/x-ndjson'
      - 'application/x-jsonlines'

# exclude packages from the build before sending to AWS
package:
  exclude:
    - node_modules/**
    - venv/**
    - .pytest_cache/**
    - .serverless/**
    - tests/**

provider:
  name: aws
  runtime: python3.8
  region: us-east-2
  environment:
    ENV: ${self:custom.stage}

functions:
  app:
    handler: wsgi_handler.handler
    events:
      - http: ANY /
      - http: 'ANY /{proxy+}'
@gabrielleandro0801
Copy link

We're having the same problem here..
We deployed our API yesterday and we had no problems, but when we did it today around 3 hours after you commented we had exactly the same message

@logandk
Copy link
Owner

logandk commented Aug 3, 2021

It's from #184 and #185 which was merged for the 2.0.0 release. I'll revert and release 2.0.1.

@logandk logandk closed this as completed in 8137735 Aug 3, 2021
@gabrielleandro0801
Copy link

gabrielleandro0801 commented Aug 3, 2021

Thank you, man!
The release fixed our bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants