AttributeError: 'NoneType' object has no attribute 'http_content_type' Webhook Issue #9532

Closed
opened 2025-12-29 20:51:06 +01:00 by adam · 3 comments
Owner

Originally created by @viperbmw on GitHub (Apr 24, 2024).

Deployment Type

Self-hosted

NetBox Version

v3.7.6

Python Version

3.11

Steps to Reproduce

When we try to send a web hook from an event we get an error in the worker server .

AttributeError: 'NoneType' object has no attribute 'http_content_type'

Although we do for sure have the application/json set

We have a Prod and Pre Prod. The issue is only happening on the Prod server. It is the exactly same image and environment. We are running in Docker.

Expected Behavior

Expect prod to work like pre prod

Observed Behavior

RESULT 1713966969876-0

Type:
FAILED
Created at:
2024-04-24, 13:56:09
Exception:
Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.11/site-packages/rq/worker.py", line 1431, in perform_job
    rv = job.perform()
         ^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/rq/job.py", line 1280, in perform
    self._result = self._execute()
                   ^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/rq/job.py", line 1317, in _execute
    result = self.func(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/extras/webhooks.py", line 50, in send_webhook
    'Content-Type': webhook.http_content_type,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'http_content_type'
### Tasks

This did work at one point now it's not. No changes where made to the code

Originally created by @viperbmw on GitHub (Apr 24, 2024). ### Deployment Type Self-hosted ### NetBox Version v3.7.6 ### Python Version 3.11 ### Steps to Reproduce When we try to send a web hook from an event we get an error in the worker server . `AttributeError: 'NoneType' object has no attribute 'http_content_type'` Although we do for sure have the `application/json` set We have a Prod and Pre Prod. The issue is only happening on the Prod server. It is the exactly same image and environment. We are running in Docker. ### Expected Behavior Expect prod to work like pre prod ### Observed Behavior ``` RESULT 1713966969876-0 Type: FAILED Created at: 2024-04-24, 13:56:09 Exception: Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.11/site-packages/rq/worker.py", line 1431, in perform_job rv = job.perform() ^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/rq/job.py", line 1280, in perform self._result = self._execute() ^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/rq/job.py", line 1317, in _execute result = self.func(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/extras/webhooks.py", line 50, in send_webhook 'Content-Type': webhook.http_content_type, ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'http_content_type' ``` ```[tasklist] ### Tasks ``` This did work at one point now it's not. No changes where made to the code
adam closed this issue 2025-12-29 20:51:06 +01:00
Author
Owner

@viperbmw commented on GitHub (Apr 24, 2024):

Screenshot 2024-04-24 at 10 07 47 AM Screenshot 2024-04-24 at 10 07 24 AM
@viperbmw commented on GitHub (Apr 24, 2024): <img width="854" alt="Screenshot 2024-04-24 at 10 07 47 AM" src="https://github.com/netbox-community/netbox/assets/56923316/f90bfa15-6e4f-4b44-b2df-f70acacfe462"> <img width="852" alt="Screenshot 2024-04-24 at 10 07 24 AM" src="https://github.com/netbox-community/netbox/assets/56923316/8256d030-300f-4435-b379-4fcc45dc8bae">
Author
Owner

@jeffgdotorg commented on GitHub (Apr 24, 2024):

Thank you for opening a bug report.

I need you to make the steps to reproduce so straightforward that a product manager (like me) can get it to happen on a fresh instance in the lab. That's going to mean some extra work for you; please keep in mind that every minute we spend puzzling out how you're getting the problem to trigger is a minute that we're not working on another issue.

Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@jeffgdotorg commented on GitHub (Apr 24, 2024): Thank you for opening a bug report. I need you to make the steps to reproduce so straightforward that a product manager (like me) can get it to happen on a fresh instance in the lab. That's going to mean some extra work for you; please keep in mind that every minute we spend puzzling out how you're getting the problem to trigger is a minute that we're not working on another issue. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
Author
Owner

@viperbmw commented on GitHub (May 7, 2024):

The issue was I was not pointing to the correct DB

@viperbmw commented on GitHub (May 7, 2024): The issue was I was not pointing to the correct DB
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9532