Skip to content

Commit

Permalink
Allow requestContext.authorizer be None
Browse files Browse the repository at this point in the history
On Scaleway at least, authorizer is often None:

    "requestContext": {
      "accountId": "",
      "resourceId": "",
      "stage": "",
      "requestId": "",
      "resourcePath": "",
      "authorizer": None,
      "httpMethod": "GET",
      "apiId": ""
    },
  • Loading branch information
andrewshadura committed Nov 18, 2022
1 parent 72de525 commit 039cfe9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions serverless_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ def handle_payload_v1(app, event, context):
"REMOTE_ADDR": event.get("requestContext", {})
.get("identity", {})
.get("sourceIp", ""),
"REMOTE_USER": event.get("requestContext", {})
.get("authorizer", {})
"REMOTE_USER": (event.get("requestContext", {})
.get("authorizer") or {})
.get("principalId", ""),
"REQUEST_METHOD": event.get("httpMethod", {}),
"SCRIPT_NAME": script_name,
Expand Down

0 comments on commit 039cfe9

Please sign in to comment.