Error on Webhook

Hi, I am trying to get a outgoing webhook working on my deployment.

Sadly I get the following error on all settings:

Traceback with variables (most recent call last):
  File "apps/frappe/frappe/utils/background_jobs.py", line 162, in execute_job
    method(**kwargs)
      site = 'erp.example.com'
      method = <function enqueue_webhook at 0x7fdb9b6780d0>
      event = None
      job_name = 'frappe.integrations.doctype.webhook.webhook.enqueue_webhook'
      kwargs = {'doc': <Document: asdfasdf>, 'webhook': {'name': 'HOOK-0002', 'condition': '', 'webhook_docevent': 'on_update', 'webhook_doctype': 'Test Request'}}
      user = 'user@example.com'
      is_async = True
      retry = 0
      method_name = 'frappe.integrations.doctype.webhook.webhook.enqueue_webhook'
  File "apps/frappe/frappe/integrations/doctype/webhook/webhook.py", line 139, in enqueue_webhook
    log_request(webhook.request_url, headers, data, r)
      doc = <Document: asdfasdf>
      webhook = <Webhook: HOOK-0002>
      headers = {'Content-Type': 'application/x-www-form-urlencoded'}
      data = {'title': 'asdfasdf', 'request': 'asdasdfasdf', 'difficulty': 'Advanced', 'length': 500}
      i = 0
builtins.UnboundLocalError: local variable 'r' referenced before assignment

I am running version 14 with todays updates all standard setup.
There are only error logs and nothing under Webhook Request log.

Does anyone has a idea what that could be and how to solve it?

I saw a couple of other posts which had this problem and there also was a github request which is marked as fixed: fix: local variable 'r' referenced before assignment · Issue #14841 · frappe/frappe · GitHub

Strangely I have no core changes and update with “bench update --reset” and also made a hard reset on frappe and erpnext seperately.

The problem still persists.

A couple of version updates later…
It finally worked out of the blue :grinning: