看起來課程 n8n102 的設計目的是讓學習者感到困擾,首先它在第 1 節的 SendToPriorityQueue 部分有一個尚未解決的 Bug,現在 Webhook 部分也無法跟進,因為測試頁面需要 https,而教程使用的是 http,所以再次在動手練習的開始階段卡住了。以下是 JSON/工作流程錯誤螢幕截圖:
{
“nodes”: [
{
“parameters”: {
“httpMethod”: “POST”,
“path”: “course/n8n102/new-order”,
“authentication”: “headerAuth”,
“responseMode”: “responseNode”,
“options”: {
“allowedOrigins”: “*”
}
},
“type”: “n8n-nodes-base.webhook”,
“typeVersion”: 2.1,
“position”: [
0,
0
],
“id”: “5b647ab0-18c4-41a4-bb01-62fddb40e0d7”,
“name”: “WebhookNewOrder”,
“webhookId”: “cb64f5fc-8c9c-4d7d-abb7-7f3ca5eb7305”,
“credentials”: {
“httpHeaderAuth”: {
“id”: “vMHAPkPKaravjcEZ”,
“name”: “n8n Academy API Key”
}
}
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 3
},
“conditions”: [
{
“id”: “dd887f0b-a710-4f6d-ae7b-4135da5667a8”,
“leftValue”: “={{ $json.body.order_id }}”,
“rightValue”: “”,
“operator”: {
“type”: “string”,
“operation”: “notEmpty”,
“singleValue”: true
}
},
{
“id”: “a7140c1e-23cc-4dba-9662-0059886cdb53”,
“leftValue”: “={{ $json.body.customer_id }}”,
“rightValue”: “”,
“operator”: {
“type”: “string”,
“operation”: “notEmpty”,
“singleValue”: true
}
},
{
“id”: “438dee60-5bcf-4002-927e-280813e11b18”,
“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”: “9fb45b77-fe7c-4240-848b-deadf5cf8bc7”,
“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”: “b945dafb-6e2f-461a-8534-414b735b7ab8”,
“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”: “b23fadc8-b731-444d-bc84-10cb1f7d9f38”,
“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”: “1b202188b62737e64678f469a8e86b98e8d2c2147255e95f1e4af4dc019b5e9d”
}
}