mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 14:32:04 +00:00
## Bug Description
handleCreateWorkflow and handleUpdateFullWorkflow were incorrectly
normalizing node types from FULL form (n8n-nodes-base.webhook) to
SHORT form (nodes-base.webhook) before validation and API calls.
This caused 100% failure rate for workflow creation because:
- n8n API requires FULL form (n8n-nodes-base.*)
- Database stores SHORT form (nodes-base.*)
- NodeTypeNormalizer converts TO SHORT form (for database)
- But was being used BEFORE API calls (incorrect)
## Root Cause
NodeTypeNormalizer was designed for database lookups but was
incorrectly applied to API operations. The method name
`normalizeToFullForm()` is misleading - it actually normalizes
TO SHORT form.
## Changes
1. handlers-n8n-manager.ts:
- Removed NodeTypeNormalizer.normalizeWorkflowNodeTypes() from
handleCreateWorkflow (line 288)
- Removed normalization from handleUpdateFullWorkflow (line 544-557)
- Added proactive SHORT form detection with helpful errors
- Added comments explaining n8n API expects FULL form
2. node-type-normalizer.ts:
- Added prominent WARNING about not using before API calls
- Added examples showing CORRECT vs INCORRECT usage
- Clarified this is FOR DATABASE OPERATIONS ONLY
3. handlers-n8n-manager.test.ts:
- Fixed test to expect FULL form (not SHORT) sent to API
- Removed incorrect expectedNormalizedInput assertion
4. NEW: workflow-creation-node-type-format.test.ts:
- 7 integration tests with real validation (unmocked)
- Tests FULL form acceptance, SHORT form rejection
- Tests real-world workflows (webhook, schedule trigger)
- Regression test to prevent bug reintroduction
## Verification
Before fix:
❌ Manual Trigger → Set: FAILED
❌ Webhook → HTTP Request: FAILED
Failure rate: 100%
After fix:
✅ Manual Trigger → Set: SUCCESS (ID: kTAaDZwdpzj8gqzM)
✅ Webhook → HTTP Request: SUCCESS (ID: aPtQUb54uuHIqX52)
✅ All 39 tests passing (32 unit + 7 integration)
Success rate: 100%
## Impact
- Fixes: Complete blocking bug preventing all workflow creation
- Risk: Zero (removing buggy behavior)
- Breaking: None (external API unchanged)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
0 lines
0 B
Plaintext
0 lines
0 B
Plaintext
The file is empty.