Project

Profile

Help

Issue #4323

/pulp/api/v3/ returns 500 error

Added by amacdona@redhat.com 9 months ago. Updated 6 months ago.

Status:
MODIFIED
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Severity:
2. Medium
Version:
Platform Release:
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:
Sprint 48

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

Duplicated by Pulp - Issue #4426: JSON serialization of schema fails with internal server error CLOSED - DUPLICATE Actions
Copied to Pulp - Test #4462: /pulp/api/v3/ returns 500 error NEW Actions

Associated revisions

Revision fba8c39e View on GitHub
Added by daviddavis 8 months ago

Fix 500 error when accessing /pulp/api/v3/ as unauthed user

fixes #4323
https://pulp.plan.io/issues/4323

Revision fba8c39e View on GitHub
Added by daviddavis 8 months ago

Fix 500 error when accessing /pulp/api/v3/ as unauthed user

fixes #4323
https://pulp.plan.io/issues/4323

History

#1 Updated by amacdona@redhat.com 9 months 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.

#2 Updated by ppicka 9 months 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

#3 Updated by CodeHeeler 9 months 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

#4 Updated by daviddavis 9 months 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.

#5 Updated by rchan 9 months ago

  • Sprint changed from Sprint 47 to Sprint 48

#6 Updated by daviddavis 8 months ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to daviddavis

#7 Updated by daviddavis 8 months ago

  • Duplicated by Issue #4426: JSON serialization of schema fails with internal server error added

#8 Updated by daviddavis 8 months 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.

#9 Updated by daviddavis 8 months ago

  • Status changed from MODIFIED to POST

#10 Updated by daviddavis 8 months ago

  • Status changed from POST to MODIFIED

#11 Updated by daviddavis 8 months ago

  • Tags Pulp 3 added

#12 Updated by bherring 8 months ago

  • Copied to Test #4462: /pulp/api/v3/ returns 500 error added

#13 Updated by daviddavis 6 months ago

  • Sprint/Milestone set to 3.0

#14 Updated by bmbouter 6 months ago

  • Tags deleted (Pulp 3, Pulp 3 RC Blocker)

Please register to edit this issue

Also available in: Atom PDF