Closed
Bug 1229783
Opened 9 years ago
Closed 8 years ago
[traceback] Stack trace exceptions: ValueError for/api/v1/<resource>/<string>
Categories
(developer.mozilla.org Graveyard :: BrowserCompat, defect)
developer.mozilla.org Graveyard
BrowserCompat
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: mbrandt, Assigned: jwhitlock, Mentored)
References
()
Details
(Whiteboard: [type:bug][bc:infra][bc:milestone=bicycle])
Unexpected strings cause 500 errors within the API for /api/v1/<resource>/<string> Steps to reproduce: 0. https://browsercompat.herokuapp.com/api/v1/browsers/foxyeah Additional examples: https://browsercompat.herokuapp.com/api/v1/versions/799ooi https://browsercompat.herokuapp.com/api/v1/features/2gg45 https://browsercompat.herokuapp.com/api/v1/supports/m20 https://browsercompat.herokuapp.com/api/v1/specifications/333v https://browsercompat.herokuapp.com/api/v1/maturities/f https://browsercompat.herokuapp.com/api/v1/sections/45h https://browsercompat.herokuapp.com/api/v1/changesets/n0 https://browsercompat.herokuapp.com/api/v1/users/l33t Expected: A 404 error is returned Actual: A ValueError is thrown. https://rpm.newrelic.com/accounts/263620/applications/10664840/filterable_errors#/show/a2bb89-e20b58de-9906-11e5-96d2-c81f66b8ceca/stack_trace?top_facet=transactionUiName&bottom_facet=host&primary_facet=error.class&_k=az8fs9 exceptions:ValueError: invalid literal for int() with base 10: 'foxyeah' Traceback (most recent call last):File "/app/.heroku/python/bin/gunicorn", line 11, in <module>File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in runFile "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 189, in runFile "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 72, in runFile "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 174, in runFile "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 477, in manage_workersFile "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 540, in spawn_workersFile "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_workerFile "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 124, in init_processFile "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 119, in runFile "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 66, in run_for_oneFile "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 30, in acceptFile "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 130, in handleFile "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_requestFile "/app/.heroku/python/lib/python2.7/site-packages/newrelic-2.58.0.43/newrelic/api/web_transaction.py", line 717, in __iter__File "/app/.heroku/python/lib/python2.7/site-packages/newrelic-2.58.0.43/newrelic/api/web_transaction.py", line 1093, in __call__File "/app/.heroku/python/lib/python2.7/site-packages/dj_static.py", line 83, in __call__File "/app/.heroku/python/lib/python2.7/site-packages/newrelic-2.58.0.43/newrelic/api/web_transaction.py", line 1221, in _nr_wsgi_application_wrapper_File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 189, in __call__File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_responseFile "/app/.heroku/python/lib/python2.7/site-packages/newrelic-2.58.0.43/newrelic/hooks/framework_django.py", line 499, in wrapperFile "/app/.heroku/python/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_viewFile "/app/.heroku/python/lib/python2.7/site-packages/rest_framework/viewsets.py", line 87, in viewFile "/app/.heroku/python/lib/python2.7/site-packages/newrelic-2.58.0.43/newrelic/hooks/component_djangorestframework.py", line 27, in _nr_wrapper_APIView_dispatch_File "/app/.heroku/python/lib/python2.7/site-packages/rest_framework/views.py", line 466, in dispatchFile "/app/.heroku/python/lib/python2.7/site-packages/rest_framework/views.py", line 463, in dispatchFile "/app/.heroku/python/lib/python2.7/site-packages/rest_framework/mixins.py", line 56, in retrieveFile "/app/.heroku/python/lib/python2.7/site-packages/drf_cached_instances/mixins.py", line 50, in get_objectFile "/app/.heroku/python/lib/python2.7/site-packages/drf_cached_instances/mixins.py", line 65, in get_object_or_404File "/app/.heroku/python/lib/python2.7/site-packages/drf_cached_instances/models.py", line 143, in getFile "/app/.heroku/python/lib/python2.7/site-packages/drf_cached_instances/cache.py", line 136, in get_instancesFile "/app/webplatformcompat/cache.py", line 39, in browser_v1_loaderFile "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 325, in getFile "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 679, in filterFile "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 697, in _filter_or_excludeFile "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1310, in add_qFile "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1338, in _add_qFile "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1209, in build_filterFile "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1102, in build_lookupFile "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/lookups.py", line 101, in __init__File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/lookups.py", line 139, in get_prep_lookupFile "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 727, in get_prep_lookupFile "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 985, in get_prep_value
Assignee | ||
Comment 1•9 years ago
|
||
Related to bug 1078699 - strings need to be accepted URL patterns if a resource is available by slug, but misses need to be 404s, not 500s.
Blocks: 996570
Updated•8 years ago
|
Keywords: in-triage
OS: Unspecified → All
Hardware: Unspecified → All
Summary: [browsercompat][traceback] Stack trace exceptions:ValueError for/api/v1/<resource>/<string> → [traceback] Stack trace exceptions: ValueError for/api/v1/<resource>/<string>
Whiteboard: [browsercompat] → [type:bug][bc:infra]
Assignee | ||
Updated•8 years ago
|
Assignee | ||
Updated•8 years ago
|
Mentor: jwhitlock
Assignee | ||
Comment 2•8 years ago
|
||
Adding to "production-ready" milestone
Whiteboard: [type:bug][bc:infra] → [type:bug][bc:infra][bc:milestone=motorbike]
Assignee | ||
Comment 3•8 years ago
|
||
Pulling back to "bicycle" milestone, since it will be fixed with the rest of slug/alias bugs
Whiteboard: [type:bug][bc:infra][bc:milestone=motorbike] → [type:bug][bc:infra][bc:milestone=bicycle]
Updated•8 years ago
|
Assignee: nobody → jwhitlock
Status: NEW → ASSIGNED
Comment 4•8 years ago
|
||
Commits pushed to master at https://github.com/mdn/browsercompat https://github.com/mdn/browsercompat/commit/6ffcb57dd41d596f470c3bc9fdcdff17f954b2ad bug 1229783 - Full router.get_urls implementation Instead of calling super, bring in the get_urls() implementation from rest_framework.routers. This code is about to get some modifications, but this commit doesn't change current functionality. https://github.com/mdn/browsercompat/commit/f14559ff2cce51999445a1b3211f25958f184f69 bug 1229783 - Move viewfeature formats to viewset https://github.com/mdn/browsercompat/commit/c3a6c7539f7a4d366fa320594ea2aa5ad6685bb8 fix bug 1229783 - Restrict resource IDs to ints Instead of matching any string, restrict resource IDs to integers in URL patterns. Let viewsets declare an alternative_lookup function, to be used if an alternate lookup, like viewfeatures's slug lookup, is allowed. This means that resource lookups will default to 404's for non-integer IDs. https://github.com/mdn/browsercompat/commit/040276972d16c34491921df9aaee9e261eeb298d Merge pull request #98 from mdn/require_int_ids_1229783 fix bug 1229783 - require integer IDs r=self
Updated•8 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Updated•4 years ago
|
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•