描述問題/錯誤/問題
✓ 有效訂單傳回 200 及正確回應
✗ 遺失欄位傳回 400 及錯誤狀態。預期缺少必填欄位時傳回 400 錯誤
✓ 遺失身份驗證傳回 403
無法通過 webhook 測試器,已 100% 遵循指示但仍然失敗。
錯誤訊息是什麼(如果有的話)?
✓ 有效訂單傳回 200 及正確回應
✗ 遺失欄位傳回 400 及錯誤狀態。預期缺少必填欄位時傳回 400 錯誤
✓ 遺失身份驗證傳回 403
請分享你的工作流程
(在畫布上選擇節點,然後使用鍵盤快捷鍵 CMD+C/CTRL+C 和 CMD+V/CTRL+V 來複製及貼上工作流程。)
{
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "course/n8n102/new-order",
"authentication": "headerAuth",
"responseMode": "responseNode",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
0,
0
],
"id": "e562e52c-483b-4084-a08b-96a9ff6bf1a9",
"name": "WebhookNewOrder",
"webhookId": "01db53d7-73ec-40c2-b91b-2c97da6e2535",
"credentials": {
"httpHeaderAuth": {
"id": "IZ1z1MYLBwpoKx2J",
"name": "n8n Academy API Key"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "a65d16fa-2ec8-48ee-898e-a0ef28462992",
"leftValue": "={{ $json.body.order_id }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
}
},
{
"id": "3c8039b7-3a17-4387-805c-59ea5ff40377",
"leftValue": "={{ $json.body.customer_id }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
}
},
{
"id": "19ef2054-2b99-4b20-9a17-e4f900b9d050",
"leftValue": "={{ $json.body.total }}",
"rightValue": "",
"operator": {
"type": "number",
"operation": "notEmpty",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
208,
0
],
"id": "14611c3e-1eb2-4802-8fbc-2309d1a7074e",
"name": "ValidateRequiredFields"
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={\n \"status\": \"accepted\",\n \"order_id\": \"{{ $('WebhookNewOrder').item.json.body.order_id }}\",\n \"message\": \"Order received and queued for processing\"\n}",
"options": {
"responseCode": 200
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.5,
"position": [
416,
-96
],
"id": "d1fd5364-556a-46d4-9240-fb84f22e9767",
"name": "RespondSuccess"
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={\n \"status\": \"error\",\n \"message\": \"Missing required fields: order_id, customer_id, and total are required\"\n}",
"options": {
"responseCode": 400
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.5,
"position": [
416,
96
],
"id": "c7dad4f2-1f70-4138-914c-144de8643f7e",
"name": "RespondValidationError"
}
],
"connections": {
"WebhookNewOrder": {
"main": [
[
{
"node": "ValidateRequiredFields",
"type": "main",
"index": 0
}
]
]
},
"ValidateRequiredFields": {
"main": [
[
{
"node": "RespondSuccess",
"type": "main",
"index": 0
}
],
[
{
"node": "RespondValidationError",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "bed2988fb684ee16b2cfbdee45dcd5e341307ecfd375cd84c432f4ed9cece2d3"
}
}
分享最後一個節點傳回的輸出
關於你的 n8n 設定的資訊
-
- n8n 版本: 2.15.0
- 資料庫: SQLite(預設)
- EXECUTIONS_PROCESS 設定: main
- 執行 n8n 的方式: Docker(在 Zeabur 上)
- 作業系統: Linux(Ubuntu 24、Zeabur 託管)


