django-debug-toolbar v6.0.0 raises AttributeError #11422

Closed
opened 2025-12-29 21:45:03 +01:00 by adam · 4 comments
Owner

Originally created by @jnovinger on GitHub (Jul 29, 2025).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

When updating django-debug-toolbar to v6.0.0, an AttributeError is raised at initialization time.

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/

Django Version: 5.2.4
Python Version: 3.10.16
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'django.forms',
 'corsheaders',
 'debug_toolbar',
 'django_filters',
 'django_htmx',
 'django_tables2',
 'django_prometheus',
 'strawberry_django',
 'mptt',
 'rest_framework',
 'social_django',
 'taggit',
 'timezone_field',
 'core',
 'account',
 'circuits',
 'dcim',
 'ipam',
 'extras',
 'tenancy',
 'users',
 'utilities',
 'virtualization',
 'vpn',
 'wireless',
 'django_rq',
 'drf_spectacular',
 'drf_spectacular_sidecar',
 'netbox_branching.AppConfig']
Installed Middleware:
['strawberry_django.middlewares.debug_toolbar.DebugToolbarMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'django_htmx.middleware.HtmxMiddleware',
 'netbox.middleware.RemoteUserMiddleware',
 'netbox.middleware.CoreMiddleware',
 'netbox.middleware.MaintenanceModeMiddleware',
 'netbox_branching.middleware.BranchMiddleware']



Traceback (most recent call last):
  File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/strawberry_django/middlewares/debug_toolbar.py", line 148, in __call__
    return self.process_request(request)
  File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/strawberry_django/middlewares/debug_toolbar.py", line 159, in process_request
    response = super().__call__(request)
  File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/debug_toolbar/middleware.py", line 131, in __call__
    toolbar = DebugToolbar(request, self.get_response)
  File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/strawberry_django/middlewares/debug_toolbar.py", line 52, in _debug_toolbar_init
    _original_debug_toolbar_init(self, request, *args, **kwargs)
  File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/debug_toolbar/toolbar.py", line 46, in __init__
    self.init_store()
  File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/debug_toolbar/toolbar.py", line 121, in init_store
    self.store.set(self.request_id)

Exception Type: AttributeError at /
Exception Value: 'function' object has no attribute 'set'

Justification

This must be resolved before upgrading to newer versions.

Originally created by @jnovinger on GitHub (Jul 29, 2025). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes When updating `django-debug-toolbar` to v6.0.0, an AttributeError is raised at initialization time. ``` Environment: Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 5.2.4 Python Version: 3.10.16 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.forms', 'corsheaders', 'debug_toolbar', 'django_filters', 'django_htmx', 'django_tables2', 'django_prometheus', 'strawberry_django', 'mptt', 'rest_framework', 'social_django', 'taggit', 'timezone_field', 'core', 'account', 'circuits', 'dcim', 'ipam', 'extras', 'tenancy', 'users', 'utilities', 'virtualization', 'vpn', 'wireless', 'django_rq', 'drf_spectacular', 'drf_spectacular_sidecar', 'netbox_branching.AppConfig'] Installed Middleware: ['strawberry_django.middlewares.debug_toolbar.DebugToolbarMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'django_htmx.middleware.HtmxMiddleware', 'netbox.middleware.RemoteUserMiddleware', 'netbox.middleware.CoreMiddleware', 'netbox.middleware.MaintenanceModeMiddleware', 'netbox_branching.middleware.BranchMiddleware'] Traceback (most recent call last): File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/strawberry_django/middlewares/debug_toolbar.py", line 148, in __call__ return self.process_request(request) File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/strawberry_django/middlewares/debug_toolbar.py", line 159, in process_request response = super().__call__(request) File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/debug_toolbar/middleware.py", line 131, in __call__ toolbar = DebugToolbar(request, self.get_response) File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/strawberry_django/middlewares/debug_toolbar.py", line 52, in _debug_toolbar_init _original_debug_toolbar_init(self, request, *args, **kwargs) File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/debug_toolbar/toolbar.py", line 46, in __init__ self.init_store() File "/Users/jnovinger/.virtualenvs/netbox/lib/python3.10/site-packages/debug_toolbar/toolbar.py", line 121, in init_store self.store.set(self.request_id) Exception Type: AttributeError at / Exception Value: 'function' object has no attribute 'set' ``` ### Justification This must be resolved before upgrading to newer versions.
adam added the status: acceptedtype: housekeepingnetbox labels 2025-12-29 21:45:03 +01:00
adam closed this issue 2025-12-29 21:45:04 +01:00
Author
Owner

@jnovinger commented on GitHub (Aug 6, 2025):

Initial investigation indicates this is possibly an issue due to a compatibility problem between Strawberry Django's debug toolbar middleware and django-debug-toolbar v6.0.0's store changes, where the middleware's monkey patching could be causing self.store to become a bound method instead of the expected store class.

Edit to add: very possibly this bug https://github.com/strawberry-graphql/strawberry-django/issues/783

Confirmed that removing "strawberry_django.middlewares.debug_toolbar.DebugToolbarMiddleware" from MIDDLEWARE in settings.py works around this issue.

@jnovinger commented on GitHub (Aug 6, 2025): Initial investigation indicates this is possibly an issue due to a compatibility problem between Strawberry Django's debug toolbar middleware and django-debug-toolbar v6.0.0's store changes, where the middleware's monkey patching could be causing `self.store` to become a bound method instead of the expected store class. **Edit to add:** very possibly this bug https://github.com/strawberry-graphql/strawberry-django/issues/783 Confirmed that removing `"strawberry_django.middlewares.debug_toolbar.DebugToolbarMiddleware"` from `MIDDLEWARE` in `settings.py` works around this issue.
Author
Owner

@jnovinger commented on GitHub (Sep 10, 2025):

Confirmed that this is still happening with the most recent versions of django-debug-toolbar (v6.0.0) and strawberry-django (v0.65.1). Currently we've chosen to stay current with strawberry-django and pin to django-debug-toolbar<6.0.0 until this is fixed.

I had originally planned to dig in to this during this cycle and report upstream if it wasn't a NetBox specific issue. Given that https://github.com/strawberry-graphql/strawberry-django/issues/783 is already reported, there's not much I can do at the moment. If I have some extra time at the end of this cycle I'll see if I can dig in to the upstream issue and try to provide a fix.

@jnovinger commented on GitHub (Sep 10, 2025): Confirmed that this is still happening with the most recent versions of `django-debug-toolbar` (v6.0.0) and `strawberry-django` (v0.65.1). Currently we've chosen to stay current with `strawberry-django` and pin to `django-debug-toolbar<6.0.0` until this is fixed. I had originally planned to dig in to this during this cycle and report upstream if it wasn't a NetBox specific issue. Given that https://github.com/strawberry-graphql/strawberry-django/issues/783 is already reported, there's not much I can do at the moment. If I have some extra time at the end of this cycle I'll see if I can dig in to the upstream issue and try to provide a fix.
Author
Owner

@jnovinger commented on GitHub (Sep 10, 2025):

I'm marking this as blocked on https://github.com/strawberry-graphql/strawberry-django/issues/783 for the time being and throwing it back on the pile.

@jnovinger commented on GitHub (Sep 10, 2025): I'm marking this as blocked on https://github.com/strawberry-graphql/strawberry-django/issues/783 for the time being and throwing it back on the pile.
Author
Owner

@jeremystretch commented on GitHub (Oct 14, 2025):

This appears to have been addressed in django-strawberry v0.66.0.

@jeremystretch commented on GitHub (Oct 14, 2025): This appears to have been addressed in [django-strawberry v0.66.0](https://github.com/strawberry-graphql/strawberry-django/releases/tag/v0.66.0).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11422