Skip to content

Fix AWS Lambda/Gateway API stage issue #220

Closed
@jamesfisher-geo

Description

@jamesfisher-geo

Is your feature request related to a problem? Please describe.

When deploying sfeos as an AWS Serverless Lambda Function with an API Gateway I hit an issue with the root URL. Gateway API requires one to deploy an API to a stage. The name of which is appended to the root URL of the API (https://{api_Id}.execute-api.{region}.amazonaws.com/{stage}/, for example). However, the Starlette base_url parameter in the request does not include the stage name. This results in all generated links yielding a 403 error (https://{api_Id}.execute-api.{region}.amazonaws.com/collections/ rather than https://{api_Id}.execute-api.{region}.amazonaws.com/{stage}/collections/).

Describe the solution you'd like
I found this issue which found a solution by adding app.root_path = '/{stage} to app.py. I propose we add an environment variable to enable devs to set the stage name as a workaround for this Gateway API issue.

Describe alternatives you've considered
Others have solved this by using Forwarded or x-Forwarded` proxy headers. However, the Gateway API does did not let me implement proxy headers when connecting to a Lambda function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions