-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Description
NetBox version
v3.2.7
Python version
3.10
Steps to Reproduce
- Setup a fresh install of NetBox
- Setup logging to debug (may not be required)
- Open Django Swagger page
- Observe below error in the logs:
default for PrimaryKeyRelatedField(allow_null=True, default=CurrentUserDefault(), queryset=<QuerySet [<User: admin>]>, required=False) is callable but it raised an exception when called; 'default' will not be set on schema
Traceback (most recent call last):
File "/opt/netbox/venv/lib/python3.10/site-packages/drf_yasg/utils.py", line 487, in get_field_default
default = default(field)
File "/opt/netbox/venv/lib/python3.10/site-packages/rest_framework/fields.py", line 290, in __call__
return serializer_field.context['request'].user
KeyError: 'request'
172.24.0.1 - - [28/Jul/2022:16:54:33 +0000] "GET /api/docs/?format=openapi HTTP/1.1" 200 1074260 "http://localhost:8000/api/docs/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"
Expected Behavior
No Error
Observed Behavior
Nothing major, just noise in the logs and possibly a delay in loading the swagger page.
Metadata
Metadata
Assignees
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application