From 9ea052a045eba60f4f53166120d8c8de92f580c6 Mon Sep 17 00:00:00 2001 From: Alexis Rolland Date: Tue, 14 Jul 2026 17:14:51 +0800 Subject: [PATCH] Add guardrails --- comfy_api_nodes/util/_helpers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/comfy_api_nodes/util/_helpers.py b/comfy_api_nodes/util/_helpers.py index 4d96f7ddf..ddfb3b65c 100644 --- a/comfy_api_nodes/util/_helpers.py +++ b/comfy_api_nodes/util/_helpers.py @@ -58,13 +58,16 @@ def get_comfy_api_headers(node_cls: type[IO.ComfyNode]) -> dict[str, str]: relative/cloud URLs resolved against ``default_base_url()``; because the result includes auth, callers must not attach it to arbitrary absolute/presigned URLs. """ - return { + headers = { **get_auth_header(node_cls), "Comfy-Env": get_deploy_environment(), "Comfy-Usage-Source": get_usage_source(node_cls), "Comfy-Core-Version": comfyui_version, - "Comfy-Job-Id": get_executing_context().prompt_id, } + ctx = get_executing_context() + if ctx is not None: + headers["Comfy-Job-Id"] = ctx.prompt_id + return headers def default_base_url() -> str: