question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Server error when browsing admin trough the API.

See original GitHub issue

Issue Summary

Server error when browsing admin trough the API and there was stale content type(s) (because app is removed or branch is changed during development). It is similar to the error that was fixed by #3569 but this is for the API.

Steps to Reproduce

  1. Create some app with page model extending from Page
  2. Add a page of the time from the new app.
  3. Commit the changes in new branch and then go back to master, or just remove the app from INSTALLED_APPS
  4. From Admin start navigating inside root page by clicking the right arrow from left menu (pages).

It should display list of pages under the root page bit instead will show Server error.

Technical details

  • Python version: 3.6
  • Django version: 1.11.5
  • Wagtail version: 1.12.1
  • Browser version: Chrome 61

Traceback:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3.6/site-packages/django/views/decorators/cache.py", line 43, in _cache_controlled
    response = viewfunc(request, *args, **kw)
  File "/usr/lib/python3.6/site-packages/wagtail/wagtailadmin/decorators.py", line 31, in decorated_view
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/wagtail/api/v2/router.py", line 65, in wrapped
    return func(request, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/rest_framework/viewsets.py", line 90, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 489, in dispatch
    response = self.handle_exception(exc)
  File "/usr/lib/python3.6/site-packages/wagtail/api/v2/endpoints.py", line 95, in handle_exception
    return super(BaseAPIEndpoint, self).handle_exception(exc)
  File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 449, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/usr/lib/python3.6/site-packages/rest_framework/views.py", line 486, in dispatch
    response = handler(request, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/wagtail/wagtailadmin/api/endpoints.py", line 93, in listing_view
    response = super(PagesAdminAPIEndpoint, self).listing_view(request)
  File "/usr/lib/python3.6/site-packages/wagtail/api/v2/endpoints.py", line 81, in listing_view
    return self.get_paginated_response(serializer.data)
  File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 739, in data
    ret = super(ListSerializer, self).data
  File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 263, in data
    self._data = self.to_representation(self.instance)
  File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 657, in to_representation
    self.child.to_representation(item) for item in iterable
  File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 657, in <listcomp>
    self.child.to_representation(item) for item in iterable
  File "/usr/lib/python3.6/site-packages/wagtail/api/v2/serializers.py", line 284, in to_representation
    meta[field.field_name] = field.to_representation(attribute)
  File "/usr/lib/python3.6/site-packages/wagtail/api/v2/serializers.py", line 91, in to_representation
    name = page.specific_class._meta.app_label + '.' + page.specific_class.__name__
AttributeError: 'NoneType' object has no attribute '_meta'

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Pomaxcommented, Aug 8, 2018

it really was a matter of having both a dev and prod instance that both needed to run v2 rather than having one set to v2, and the other to v1, with migrations that belonged to v1 being used with the v2 instance. The solution was to first upgrade the v1 instance to v2, making sure to fix migrations so they pointed to the new app names instead of the old app names.

0reactions
gasmancommented, Aug 16, 2018

Fixed in #4648

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP 500 Internal Server Error: What It Means & How to Fix It
This error is a server response to stop sending requests because of overloaded resources. This code might show up if your site needs...
Read more >
500 Internal Server Error - Backend Server | Apigee Edge
The 500 Internal Server Error responded by the backend server can be caused by a number of reasons. You will need to diagnose...
Read more >
401 Error: 5 Ways to Troubleshoot and Fix It - Hostinger
The 401 Unauthorized error is triggered by unauthenticated requests made to a WordPress web server. Learn how to identify and fix the issue....
Read more >
HTTP Error 500.0 error - Internet Information Services
This problem occurs because the server that is running IIS 7.0 cannot access the configured root directory of the requested location. Resolution.
Read more >
How to Fix a 500 Internal Server Error on Your WordPress Site
Today we're going to dive into the 500 internal server error and walk you through some ways to get your site back online...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found