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

Fix AWS Lambda/Gateway API stage issue #220

Closed
jamesfisher-geo opened this issue Mar 29, 2024 · 0 comments · Fixed by #221
Closed

Fix AWS Lambda/Gateway API stage issue #220

jamesfisher-geo opened this issue Mar 29, 2024 · 0 comments · Fixed by #221

Comments

@jamesfisher-geo
Copy link
Collaborator

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.

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

Successfully merging a pull request may close this issue.

1 participant