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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix(api): add bounded timeouts to Marketplace POST requests (#37424)
citizen204f06278951a76
diff --git a/api/core/helper/marketplace.py b/api/core/helper/marketplace.pyindex d7b6e820625..2c7d520250c 100644--- a/api/core/helper/marketplace.py+++ b/api/core/helper/marketplace.py@@ -12,6 +12,8 @@ from extensions.ext_redis import redis_clientmarketplace_api_url = URL(str(dify_config.MARKETPLACE_API_URL))logger = logging.getLogger(__name__)+MARKETPLACE_TIMEOUT = 30+def get_plugin_pkg_url(plugin_unique_identifier: str) -> str:return str((marketplace_api_url / "api/v1/plugins/download").with_query(unique_identifier=plugin_unique_identifier))@@ -26,7 +28,12 @@ def batch_fetch_plugin_manifests(plugin_ids: list[str]) -> Sequence[MarketplacePreturn []url = str(marketplace_api_url / "api/v1/plugins/batch")- response = httpx.post(url, json={"plugin_ids": plugin_ids}, headers={"X-Dify-Version": dify_config.project.version})+ response = httpx.post(+ url,+ json={"plugin_ids": plugin_ids},+ headers={"X-Dify-Version": dify_config.project.version},+ timeout=MARKETPLACE_TIMEOUT,+ )response.raise_for_status()return [MarketplacePluginDeclaration.model_validate(plugin) for plugin in response.json()["data"]["plugins"]]@@ -37,7 +44,12 @@ def batch_fetch_plugin_by_ids(plugin_ids: list[str]) -> list[dict]:return []url = str(marketplace_api_url / "api/v1/plugins/batch")- response = httpx.post(url, json={"plugin_ids": plugin_ids}, headers={"X-Dify-Version": dify_config.project.version})+ response = httpx.post(+ url,+ json={"plugin_ids": plugin_ids},+ headers={"X-Dify-Version": dify_config.project.version},+ timeout=MARKETPLACE_TIMEOUT,+ )response.raise_for_status()data = response.json()@@ -46,7 +58,7 @@ def batch_fetch_plugin_by_ids(plugin_ids: list[str]) -> list[dict]:def record_install_plugin_event(plugin_unique_identifier: str):url = str(marketplace_api_url / "api/v1/stats/plugins/install_count")- response = httpx.post(url, json={"unique_identifier": plugin_unique_identifier})+ response = httpx.post(url, json={"unique_identifier": plugin_unique_identifier}, timeout=MARKETPLACE_TIMEOUT)response.raise_for_status()@@ -64,7 +76,7 @@ def fetch_global_plugin_manifest(cache_key_prefix: str, cache_ttl: int) -> None:Exception: If any other error occurs during fetching or caching"""url = str(marketplace_api_url / "api/v1/dist/plugins/manifest.json")- response = httpx.get(url, headers={"X-Dify-Version": dify_config.project.version}, timeout=30)+ response = httpx.get(url, headers={"X-Dify-Version": dify_config.project.version}, timeout=MARKETPLACE_TIMEOUT)response.raise_for_status()raw_json = response.json()