You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently working on running Kinto on AWS Lambda, using the provided app.wsgi file to load Kinto.
My Kinto instance is deployed at a URL containing a prefix, https://api.gateway.amazon/dev/v1.
When translating Lambda events to WSGI environment parameters, I'm setting SCRIPT_NAME to /dev, and PATH_INFO to /v1. If I do this, Kinto complains that /dev/v1 is not a valid route. If I explicitly remove SCRIPT_NAME from the environment variables before calling the app, it works fine.
I believe this is due to Pyramid/Waitress combining the SCRIPT_NAME and PATH_INFO when passing the URL to Kinto. I'm doing some research into how this can be disabled (and if this is even the cause), and I'll send a PR if I find the appropriate config option.
"POST /dev/v1/buckets/default/collections/tasks/records?" ? (? ms) URI has no route errno=999
Traceback (most recent call last):
File "/Users/dylanstaley/Desktop/kinto-wsgi/.venv/lib/python3.6/site-packages/pyramid/tweens.py", line 39, in excview_tween
response = handler(request)
File "/Users/dylanstaley/Desktop/kinto-wsgi/.venv/lib/python3.6/site-packages/kinto/core/events.py", line 76, in tween
response = handler(request)
File "/Users/dylanstaley/Desktop/kinto-wsgi/.venv/lib/python3.6/site-packages/pyramid/router.py", line 156, in handle_request
view_name
File "/Users/dylanstaley/Desktop/kinto-wsgi/.venv/lib/python3.6/site-packages/pyramid/view.py", line 642, in _call_view
response = view_callable(context, request)
File "/Users/dylanstaley/Desktop/kinto-wsgi/.venv/lib/python3.6/site-packages/pyramid/viewderivers.py", line 410, in viewresult_to_response
result = view(context, request)
File "/Users/dylanstaley/Desktop/kinto-wsgi/.venv/lib/python3.6/site-packages/pyramid/viewderivers.py", line 148, in _requestonly_view
response = view(request)
File "/Users/dylanstaley/Desktop/kinto-wsgi/.venv/lib/python3.6/site-packages/kinto/plugins/default_bucket/__init__.py", line 145, in default_bucket
create_bucket(request, bucket_id)
File "/Users/dylanstaley/Desktop/kinto-wsgi/.venv/lib/python3.6/site-packages/kinto/plugins/default_bucket/__init__.py", line 35, in create_bucket
uri=bucket_uri)
File "/Users/dylanstaley/Desktop/kinto-wsgi/.venv/lib/python3.6/site-packages/kinto/plugins/default_bucket/__init__.py", line 79, in resource_create_object
resource_name, matchdict = view_lookup(request, uri)
File "/Users/dylanstaley/Desktop/kinto-wsgi/.venv/lib/python3.6/site-packages/kinto/core/utils.py", line 448, in view_lookup
return view_lookup_registry(request.registry, uri)
File "/Users/dylanstaley/Desktop/kinto-wsgi/.venv/lib/python3.6/site-packages/kinto/core/utils.py", line 472, in view_lookup_registry
raise ValueError('URI has no route')
Changing the SCRIPT_NAME attribute to '' eliminates the error.
The text was updated successfully, but these errors were encountered:
The reproduction that manually specifies the WSGI variables was just to demonstrate the error. In a proper WSGI environment, SCRIPT_NAME is set by the web server. I imagine this would be an issue for any WSGI host that has Kinto at a non-root level.
alexcottner
added
the
stale
For marking issues as stale. Labeled issues will be closed soon if label is not removed.
label
Jul 23, 2024
I'm currently working on running Kinto on AWS Lambda, using the provided app.wsgi file to load Kinto.
My Kinto instance is deployed at a URL containing a prefix,
https://api.gateway.amazon/dev/v1
.When translating Lambda events to WSGI environment parameters, I'm setting
SCRIPT_NAME
to/dev
, andPATH_INFO
to/v1
. If I do this, Kinto complains that/dev/v1
is not a valid route. If I explicitly removeSCRIPT_NAME
from the environment variables before calling the app, it works fine.I believe this is due to Pyramid/Waitress combining the
SCRIPT_NAME
andPATH_INFO
when passing the URL to Kinto. I'm doing some research into how this can be disabled (and if this is even the cause), and I'll send a PR if I find the appropriate config option.Here's a short reproduction:
This is the error I'm getting:
Changing the
SCRIPT_NAME
attribute to''
eliminates the error.The text was updated successfully, but these errors were encountered: