Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(api): repair two malformed logger format strings (#40901)

Amogh Bhat Nagri30c304c6a732
diff --git a/api/controllers/trigger/trigger.py b/api/controllers/trigger/trigger.py
index c10b94050c5..203bfdf895d 100644
--- a/api/controllers/trigger/trigger.py
+++ b/api/controllers/trigger/trigger.py
@@ -39,5 +39,5 @@ def trigger_endpoint(endpoint_id: str):
except ValueError as e:
return jsonify({"error": "Endpoint processing failed", "message": str(e)}), 400
except Exception:
- logger.exception("Webhook processing failed for {endpoint_id}")
+ logger.exception("Webhook processing failed for %s", endpoint_id)
return jsonify({"error": "Internal server error"}), 500
diff --git a/api/controllers/web/human_input_form.py b/api/controllers/web/human_input_form.py
index a897508e798..5668b97abaa 100644
--- a/api/controllers/web/human_input_form.py
+++ b/api/controllers/web/human_input_form.py
@@ -262,7 +262,7 @@ class HumanInputFormApi(Resource):
raise NotFoundError("Form not found")
if (recipient_type := form.recipient_type) is None:
- logger.warning("Recipient type is None for form, form_id=%", form.id)
+ logger.warning("Recipient type is None for form, form_id=%s", form.id)
raise AssertionError("Recipient type is None")
try:
diff --git a/api/tests/unit_tests/controllers/trigger/test_trigger.py b/api/tests/unit_tests/controllers/trigger/test_trigger.py
index 1d6db9e232b..c7079d332c1 100644
--- a/api/tests/unit_tests/controllers/trigger/test_trigger.py
+++ b/api/tests/unit_tests/controllers/trigger/test_trigger.py
@@ -1,3 +1,4 @@
+import logging
from unittest.mock import patch
import pytest
@@ -71,3 +72,11 @@ class TestTriggerEndpoint:
assert status == 500
assert response["error"] == "Internal server error"
+
+ @patch.object(module.TriggerService, "process_endpoint", side_effect=Exception("boom"))
+ def test_unexpected_exception_logs_endpoint_id(self, mock_trigger, caplog):
+ with caplog.at_level(logging.ERROR, logger=module.logger.name):
+ module.trigger_endpoint(VALID_UUID)
+
+ assert VALID_UUID in caplog.text
+ assert "{endpoint_id}" not in caplog.text