N8N Academy 訂單問題 bug

Describe the problem/error/question

I reach this stage: Hands-on Exercise: Building an API Integration Pipeline Step 2.5: Send enterprise orders to priority queue. After execute the entire workflow, below error came out.

What is the error message (if any)?

Your request is invalid or could not be processed by the service [item 0]

Invalid order_id. Please ensure you are sending the correct order_id

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
{
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -32,
        112
      ],
      "id": "fee606ca-797e-47d8-af47-b655ffdc8fe1",
      "name": "TriggerManual"
    },
    {
      "parameters": {
        "url": "https://learn.app.n8n.cloud/webhook/course/n8n102/orders",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Assessment-ID",
              "value": "1d6f2263fd81b44480a5486782c87be0"
            }
          ]
        },
        "options": {
          "pagination": {
            "pagination": {
              "parameters": {
                "parameters": [
                  {
                    "name": "page",
                    "value": "={{ $pageCount + 1 }}"
                  }
                ]
              }
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        208,
        0
      ],
      "id": "f46e1a0c-072f-487b-ae64-de7188cb4bc4",
      "name": "GetOrders",
      "credentials": {
        "httpHeaderAuth": {
          "id": "IZ1z1MYLBwpoKx2J",
          "name": "n8n Academy API Key"
        }
      }
    },
    {
      "parameters": {
        "url": "https://learn.app.n8n.cloud/webhook/course/n8n102/customers",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Assessment-ID",
              "value": "1d6f2263fd81b44480a5486782c87be0"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        208,
        224
      ],
      "id": "7e000a51-f7f0-4e57-b93b-8f858f077833",
      "name": "GetCustomers",
      "credentials": {
        "httpHeaderAuth": {
          "id": "IZ1z1MYLBwpoKx2J",
          "name": "n8n Academy API Key"
        }
      }
    },
    {
      "parameters": {
        "mode": "combine",
        "fieldsToMatchString": "customer_id",
        "joinMode": "enrichInput1",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        432,
        112
      ],
      "id": "c09f91fd-fd86-414e-a24f-5e56aa38d9c2",
      "name": "MergeOrdersCustomers"
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "enriched_orders",
        "options": {}
      },
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        640,
        112
      ],
      "id": "47ffb582-3bbc-40af-97af-d8c4546c2d6e",
      "name": "AggregateOrders"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://learn.app.n8n.cloud/webhook/course/n8n102/orders-queue",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Assessment-ID",
              "value": "1d6f2263fd81b44480a5486782c87be0"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "enriched_orders",
              "value": "={{ $json.enriched_orders }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        880,
        112
      ],
      "id": "d80c1831-d69a-42da-bc3a-7e646393475d",
      "name": "SendToOrdersQueue",
      "credentials": {
        "httpHeaderAuth": {
          "id": "IZ1z1MYLBwpoKx2J",
          "name": "n8n Academy API Key"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "d9ae70e7-274b-47c6-a87d-5469702d4b8a",
              "leftValue": "={{ $json.subscription }}",
              "rightValue": "Enterprise",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        624,
        336
      ],
      "id": "1c1e831c-ebb1-45d9-b560-acfea9bc2cbf",
      "name": "CheckSubscriptionTier"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.region }}",
                    "rightValue": "north",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "13963a78-1120-4e9e-bcc2-6485b63107ab"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "North"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "ff9f6d08-d005-416f-8e0f-8460d894a709",
                    "leftValue": "={{ $json.region }}",
                    "rightValue": "south",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "South"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "cfa065fc-5a61-40b9-a7b9-6a348dcdbd75",
                    "leftValue": "={{ $json.region }}",
                    "rightValue": "east",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "East"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "b1a239e1-bbe9-4f6e-b986-533415c4a262",
                    "leftValue": "={{ $json.region }}",
                    "rightValue": "west",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "West"
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.4,
      "position": [
        832,
        432
      ],
      "id": "e2ecffd6-dcd7-4625-9abd-8400e0fd75a2",
      "name": "RouteByRegion"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "1a49d28e-2cf9-4ea4-a355-c85a6f146ae0",
              "leftValue": "={{ $json.status }}",
              "rightValue": "delivered",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.3,
      "position": [
        1120,
        320
      ],
      "id": "606971a9-c796-4cb8-8ffc-af10dfbce473",
      "name": "FilterDelivered"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://learn.app.n8n.cloud/webhook/course/n8n102/priority-queue",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Assessment-ID",
              "value": "1d6f2263fd81b44480a5486782c87be0"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "order_id",
              "value": "={{ $json.order_id }}"
            },
            {
              "name": "customer_id",
              "value": "={{ $json.customer_id }}"
            },
            {
              "name": "company_name",
              "value": "={{ $json.customer_name }}"
            },
            {
              "name": "subscription",
              "value": "={{ $json.subscription }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        1328,
        320
      ],
      "id": "02e77179-3856-4454-88dc-c391ae6ebcde",
      "name": "SendToPriorityQueue",
      "credentials": {
        "httpHeaderAuth": {
          "id": "IZ1z1MYLBwpoKx2J",
          "name": "n8n Academy API Key"
        }
      }
    }
  ],
  "connections": {
    "TriggerManual": {
      "main": [
        [
          {
            "node": "GetOrders",
            "type": "main",
            "index": 0
          },
          {
            "node": "GetCustomers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetOrders": {
      "main": [
        [
          {
            "node": "MergeOrdersCustomers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetCustomers": {
      "main": [
        [
          {
            "node": "MergeOrdersCustomers",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "MergeOrdersCustomers": {
      "main": [
        [
          {
            "node": "AggregateOrders",
            "type": "main",
            "index": 0
          },
          {
            "node": "CheckSubscriptionTier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AggregateOrders": {
      "main": [
        [
          {
            "node": "SendToOrdersQueue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SendToOrdersQueue": {
      "main": [
        []
      ]
    },
    "CheckSubscriptionTier": {
      "main": [
        [
          {
            "node": "FilterDelivered",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "RouteByRegion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FilterDelivered": {
      "main": [
        [
          {
            "node": "SendToPriorityQueue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "instanceId": "bed2988fb684ee16b2cfbdee45dcd5e341307ecfd375cd84c432f4ed9cece2d3"
  }
}

Share the output returned by the last node

Error code

422

Full message

422 - "{\"error\":\"Invalid order_id. Please ensure you are sending the correct order_id\"}"

Request

{ "body": { "order_id": "ORD-037", "customer_id": "CUST-007", "company_name": "Summit Enterprises", "subscription": "Enterprise" }, "headers": { "x-assessment-id": "1d6f2263fd81b44480a5486782c87be0", "**hidden**": "**hidden**", "accept": "application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7" }, "method": "POST", "uri": "https://learn.app.n8n.cloud/webhook/course/n8n102/priority-queue", "gzip": true, "rejectUnauthorized": true, "followRedirect": true, "resolveWithFullResponse": true, "sendCredentialsOnCrossOriginRedirect": false, "followAllRedirects": true, "timeout": 300000, "encoding": null, "json": false, "useStream": true }

Information on your n8n setup

    1. n8n version: 2.15.0
    2. Database: SQLite (default)
    3. EXECUTIONS_PROCESS setting: main
    4. Running n8n via: Docker (on Zeabur)
    5. Operating system: Linux (Ubuntu 24, Zeabur hosted)

我被同樣的錯誤卡住了,哈哈。怎樣才能解決這個問題呢?

我有完全相同的問題

你解決了嗎?我卡在同樣的錯誤上

@nicknock @evanmoo @Vonn_Villasor 這是許多人遇到的錯誤

@jamiemadden_n8n

各位好,

請仔細檢查您的參數在變數名稱前後是否有任何空格。在使用者介面中可能很難看出來。

敬禮,

我再次檢查並在雲端和自托管上都完整重現了整個工作流程兩次。在這個特定節點的 POST 請求上它返回相同的錯誤。完全和academy教程一樣,但後端仍然返回無效的 order_id 錯誤。

N8N102 也有同樣兩個問題(目前卡在 63%,需要 70% 才能獲得證書):slight_smile:

  1. 第 1 部分的 priority-queue 是 @achamm 提到的 bug。它對每個企業訂單都會傳回 422「Invalid order_id」。我直接針對端點進行測試並確認:真實的 order_id、假的 order_id 和空字符串都會傳回相同的「Invalid order_id」錯誤 — 所以對於我的評估,驗證集似乎是空的。來自 /orders 的 order_id 是乾淨的(沒有空格),所以「額外空格」的解決方案在這裡不適用。orders-queue 運作正常(orders_queued: 50)。這會阻止優先訂單佇列和最終化評估。

  2. 我的第 2 部分(Webhooks)實作練習完全通過 — 練習頁面上的全部四個評估都顯示 1.0/1.0(安全 Webhook、資料儲存、訂單處理、處理管道;「所有測試已通過」)。但它沒有計入我的成績:在進度頁面上,「n8n Workflow」成績仍然是 33.33%(僅第 1 部分),且第 2 部分沒有出現在已評分分數下。看起來是成績簿同步問題。

評估 ID:34513bee…982bf9(如需全部 ID 可應要求提供)。能否請團隊修復 priority-queue 端點及/或同步第 2 部分的成績?感謝!

Hey everyone,

I am experiencing the same bug on Step 2.5 of the N8N102 course that others have mentioned recently.

My SendToPriorityQueue node is throwing a 422 - "Invalid order_id" error, even though the order ID being sent is valid (e.g., ORD-005).

I have verified my workflow setup:

  • Data mapping is correct (={{ $json.order_id }}).
  • The BatchPriorityOrders loop is properly closed.
  • Batch size is correctly set to 5.

Here are screenshots showing the error:

And here is my workflow code for reference:

@jamiemadden_n8n @testn8n_Santiago
Thanks @jamiemadden_n8n and the team for looking into this bug.

你好,

找到問題了,已經修復了。請再試一次!

加油,