Issue #4323
closed/pulp/api/v3/ returns 500 error
Description
GET request to /pulp/api/v3/ produces the following in the logs:
pulp: django.request:ERROR: Internal Server Error: /pulp/api/v3/
Traceback (most recent call last):
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/handlers/exception.py", line 34, in in
response = get_response(request)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/handlers/base.py", line 156, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/handlers/base.py", line 154, in _get_response
response = response.render()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/template/response.py", line 106, in render
self.content = self.rendered_content
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/response.py", line 72, in rendered_content
ret = renderer.render(self.data, accepted_media_type, context)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/renderers.py", line 732, in render
context = self.get_context(data, accepted_media_type, renderer_context)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/renderers.py", line 687, in get_context
'content': self.get_content(renderer, data, accepted_media_type, renderer_context),
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/renderers.py", line 423, in get_content
content = renderer.render(data, accepted_media_type, renderer_context)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/renderers.py", line 1036, in render
structure = self.get_structure(data)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/renderers.py", line 1016, in get_structure
'title': data.title,
AttributeError: 'dict' object has no attribute 'title'
I get a 500, but only when using the browsable API.
When using httpie, I get an unusual result. Since daviddavis couldn't reproduce this, (and the result below) my assumption is that this is a problem with docker-distributions.
~/d/devel ❯ http --auth admin:admin http://pulp3:8000/pulp/api/v3/
HTTP/1.1 200 OK
Allow: GET, HEAD, OPTIONS
Content-Length: 250
Content-Type: application/vnd.oai.openapi
Date: Mon, 14 Jan 2019 21:33:50 GMT
Server: WSGIServer/0.2 CPython/3.7.2
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
info:
description: ''
title: Pulp API
version: ''
openapi: 3.0.0
paths:
/v2/:
get:
description: Return a response to the "GET" action.
operationId: v2_list
tags:
- v2
servers:
- url: http://pulp3:8000/pulp/api/v3/
Related issues
Updated by amacdona@redhat.com almost 6 years ago
@dkliban, I recently switched to pulplift and started seeing a 500 error with regular calls, instead of the browsable api. However, when I used admin:password instead of admin:admin, I got the schema as expected.
Updated by ppicka almost 6 years ago
for me on old dev env, on browsable api when I got sign in (e.g. inside tasks view) I got schema ok (as logged admin with same password), without login same issue
Updated by CodeHeeler almost 6 years ago
- Project changed from Docker Support to Pulp
- Triaged changed from No to Yes
- Sprint set to Sprint 47
- Tags Pulp 3 RC Blocker added
Updated by daviddavis almost 6 years ago
I was able to reproduce this by not being logged in. I moved my .netrc file to do so.
I think this endpoint should work the same for authenticated and unauthenticated users.
Updated by daviddavis almost 6 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to daviddavis
Updated by daviddavis almost 6 years ago
- Has duplicate Issue #4426: JSON serialization of schema fails with internal server error added
Updated by daviddavis almost 6 years ago
- Status changed from ASSIGNED to MODIFIED
This was fixed recently and should be released soon.
https://github.com/encode/django-rest-framework/issues/6258
https://github.com/encode/django-rest-framework/pull/6429
However, I tried applying the patch and it while it fixes the 500 error, it doesn't make http://pulp3:8000/pulp/api/v3/
accessible to unauthenticated users.
Updated by daviddavis almost 6 years ago
- Status changed from MODIFIED to POST
Added by daviddavis almost 6 years ago
Added by daviddavis almost 6 years ago
Revision fba8c39e | View on GitHub
Fix 500 error when accessing /pulp/api/v3/ as unauthed user
Updated by daviddavis almost 6 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulp|fba8c39e9b5480a704e76b4a64502ba562bafb86.
Updated by bherring almost 6 years ago
- Copied to Test #4462: /pulp/api/v3/ returns 500 error added
Updated by bmbouter about 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Fix 500 error when accessing /pulp/api/v3/ as unauthed user
fixes #4323 https://pulp.plan.io/issues/4323