diff --git a/api/services/app_dsl_service.py b/api/services/app_dsl_service.py index f91510d154..033a233fe3 100644 --- a/api/services/app_dsl_service.py +++ b/api/services/app_dsl_service.py @@ -599,6 +599,10 @@ class AppDslService: if data_type == NodeType.TRIGGER_SCHEDULE.value: # override the config with the default config node_data["config"] = TriggerScheduleNode.get_default_config()["config"] + if data_type == NodeType.TRIGGER_WEBHOOK.value: + # clear the webhook_url + node_data["webhook_url"] = "" + node_data["webhook_debug_url"] = "" export_data["workflow"] = workflow_dict dependencies = cls._extract_dependencies_from_workflow(workflow) diff --git a/api/services/webhook_service.py b/api/services/webhook_service.py index 5745091e87..6faf3f632e 100644 --- a/api/services/webhook_service.py +++ b/api/services/webhook_service.py @@ -669,6 +669,7 @@ class WebhookService: created_by=app.created_by, ) session.add(webhook_record) + session.flush() cache = Cache(record_id=webhook_record.id, node_id=node_id, webhook_id=webhook_record.webhook_id) redis_client.set(f"{cls.__WEBHOOK_NODE_CACHE_KEY__}:{node_id}", cache.model_dump_json(), ex=60 * 60) session.commit() diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.ts index 33fd9cdeb3..a987314a36 100644 --- a/web/app/components/workflow/hooks/use-nodes-interactions.ts +++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts @@ -63,8 +63,6 @@ import { import { WorkflowHistoryEvent, useWorkflowHistory } from './use-workflow-history' import useInspectVarsCrud from './use-inspect-vars-crud' import { getNodeUsedVars } from '../nodes/_base/components/variable/utils' -import { deleteWebhookUrl } from '@/service/apps' -import { useStore as useAppStore } from '@/app/components/app/store' // Entry node deletion restriction has been removed to allow empty workflows @@ -76,7 +74,7 @@ export const useNodesInteractions = () => { const reactflow = useReactFlow() const { store: workflowHistoryStore } = useWorkflowHistoryStore() const { handleSyncWorkflowDraft } = useNodesSyncDraft() - const appId = useAppStore.getState().appDetail?.id + const { checkNestedParallelLimit, getAfterNodesInSameBranch, @@ -592,17 +590,6 @@ export const useNodesInteractions = () => { deleteNodeInspectorVars(nodeId) - if (currentNode.data.type === BlockEnum.TriggerWebhook) { - if (appId) { - try { - deleteWebhookUrl({ appId, nodeId }) - } - catch (error) { - console.error('Failed to delete webhook URL:', error) - } - } - } - if (currentNode.data.type === BlockEnum.Iteration) { const iterationChildren = nodes.filter(node => node.parentId === currentNode.id) diff --git a/web/app/components/workflow/nodes/trigger-webhook/default.ts b/web/app/components/workflow/nodes/trigger-webhook/default.ts index d1ad6e8af6..d45825bd12 100644 --- a/web/app/components/workflow/nodes/trigger-webhook/default.ts +++ b/web/app/components/workflow/nodes/trigger-webhook/default.ts @@ -26,14 +26,6 @@ const nodeDefault: NodeDefault = { return nodes.filter(type => type !== BlockEnum.Start) }, checkValid(payload: WebhookTriggerNodeType, t: any) { - // Validate webhook configuration - if (!payload.webhook_url) { - return { - isValid: false, - errorMessage: t('workflow.nodes.triggerWebhook.validation.webhookUrlRequired'), - } - } - // Validate parameter types for params and body const parametersWithTypes = [ ...(payload.params || []), diff --git a/web/service/apps.ts b/web/service/apps.ts index 3f4f05c264..29ce0ee63e 100644 --- a/web/service/apps.ts +++ b/web/service/apps.ts @@ -159,11 +159,7 @@ export const updateTracingStatus: Fetcher = ({ appId, nodeId }) => { - return post(`apps/${appId}/workflows/triggers/webhook`, { params: { node_id: nodeId } }) -} - -export const deleteWebhookUrl: Fetcher = ({ appId, nodeId }) => { - return del(`apps/${appId}/workflows/triggers/webhook`, { params: { node_id: nodeId } }) + return get(`apps/${appId}/workflows/triggers/webhook`, { params: { node_id: nodeId } }) } export const fetchTracingConfig: Fetcher = ({ appId, provider }) => {