Project

Profile

Help

Issue #4323

closed

/pulp/api/v3/ returns 500 error

Added by amacdona@redhat.com almost 6 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 48
Quarter:

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

Has duplicate Pulp - Issue #4426: JSON serialization of schema fails with internal server errorCLOSED - DUPLICATEActions
Copied to Pulp - Test #4462: /pulp/api/v3/ returns 500 errorCLOSED - WONTFIXActions
Actions #1

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.

Actions #2

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

Actions #3

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
Actions #4

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.

Actions #5

Updated by rchan almost 6 years ago

  • Sprint changed from Sprint 47 to Sprint 48
Actions #6

Updated by daviddavis almost 6 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to daviddavis
Actions #7

Updated by daviddavis almost 6 years ago

  • Has duplicate Issue #4426: JSON serialization of schema fails with internal server error added
Actions #8

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.

Actions #9

Updated by daviddavis almost 6 years ago

  • Status changed from MODIFIED to POST

Added by daviddavis almost 6 years ago

Revision fba8c39e | View on GitHub

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

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

Added by daviddavis almost 6 years ago

Revision fba8c39e | View on GitHub

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

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

Actions #10

Updated by daviddavis almost 6 years ago

  • Status changed from POST to MODIFIED
Actions #11

Updated by daviddavis almost 6 years ago

  • Tags Pulp 3 added
Actions #12

Updated by bherring over 5 years ago

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

Updated by daviddavis over 5 years ago

  • Sprint/Milestone set to 3.0.0
Actions #14

Updated by bmbouter over 5 years ago

  • Tags deleted (Pulp 3, Pulp 3 RC Blocker)
Actions #15

Updated by bmbouter almost 5 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF