Webhooks fire erroneously when custom scripts fail causing a transaction rolback #6531

Closed
opened 2025-12-29 19:42:01 +01:00 by adam · 0 comments
Owner

Originally created by @kkthxbye-code on GitHub (Jun 2, 2022).

Originally assigned to: @kkthxbye-code on GitHub.

NetBox version

v3.2.4

Python version

3.9

Steps to Reproduce

  • Register a webhook handler for the Contact object type.
  • Run the following custom script:
from extras.scripts import Script
from tanancy.models import Contact

class MyScript(Script):
    def run(self, data, commit):
        contact = Contact(name="test")
        contact.full_clean()
        contact.save()
        raise Exception("Exception")

Expected Behavior

No webhooks are sent as the script failed and the database transaction is rolled back.

Observed Behavior

A weebhook is fired for the contact object.

Originally created by @kkthxbye-code on GitHub (Jun 2, 2022). Originally assigned to: @kkthxbye-code on GitHub. ### NetBox version v3.2.4 ### Python version 3.9 ### Steps to Reproduce * Register a webhook handler for the Contact object type. * Run the following custom script: ``` from extras.scripts import Script from tanancy.models import Contact class MyScript(Script): def run(self, data, commit): contact = Contact(name="test") contact.full_clean() contact.save() raise Exception("Exception") ``` ### Expected Behavior No webhooks are sent as the script failed and the database transaction is rolled back. ### Observed Behavior A weebhook is fired for the contact object.
adam added the type: bugstatus: accepted labels 2025-12-29 19:42:01 +01:00
adam closed this issue 2025-12-29 19:42:01 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6531