mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-06 05:23:08 +00:00
fix: correct Issue #248 - remove settings entirely from workflow updates
Previous fix attempted to whitelist settings properties, but research revealed that the n8n API update endpoint does NOT support updating settings at all. Root Cause: - n8n API rejects ANY settings properties in update requests - Properties like callerPolicy and executionOrder cannot be updated via API - See: https://community.n8n.io/t/api-workflow-update-endpoint-doesnt-support-setting-callerpolicy/161916 Solution: - Remove settings object entirely from update payloads - n8n API preserves existing settings when omitted from updates - Prevents "settings must NOT have additional properties" errors Changes: - src/services/n8n-validation.ts: Replace whitelist filtering with complete removal - tests/unit/services/n8n-validation.test.ts: Update tests to verify settings removal Testing: - All 72 unit tests passing (100% coverage) - Verified with n8n-mcp-tester on cloud workflow (n8n.estyl.team) Impact: - Workflow updates (name, nodes, connections) work correctly - Settings are preserved (not lost, just not updated) - Resolves all "settings must NOT have additional properties" errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -133,28 +133,17 @@ export function cleanWorkflowForUpdate(workflow: Workflow): Partial<Workflow> {
|
||||
...cleanedWorkflow
|
||||
} = workflow as any;
|
||||
|
||||
// Filter settings to only include valid properties (Issue #248 fix)
|
||||
// Prevents "settings must NOT have additional properties" API errors
|
||||
// CRITICAL FIX for Issue #248:
|
||||
// The n8n API update endpoint has a strict schema that REJECTS settings updates.
|
||||
// Properties like callerPolicy and executionOrder cannot be updated via the API
|
||||
// (see: https://community.n8n.io/t/api-workflow-update-endpoint-doesnt-support-setting-callerpolicy/161916)
|
||||
//
|
||||
// Solution: Remove settings entirely from update requests. The n8n API will
|
||||
// preserve existing workflow settings when they are omitted from the update payload.
|
||||
// This prevents "settings must NOT have additional properties" errors while
|
||||
// ensuring workflow updates (name, nodes, connections) work correctly.
|
||||
if (cleanedWorkflow.settings) {
|
||||
const allowedSettingsKeys = [
|
||||
'executionOrder',
|
||||
'timezone',
|
||||
'saveDataErrorExecution',
|
||||
'saveDataSuccessExecution',
|
||||
'saveManualExecutions',
|
||||
'saveExecutionProgress',
|
||||
'executionTimeout',
|
||||
'errorWorkflow',
|
||||
'callerPolicy',
|
||||
];
|
||||
|
||||
const filteredSettings: any = {};
|
||||
for (const key of allowedSettingsKeys) {
|
||||
if (key in cleanedWorkflow.settings) {
|
||||
filteredSettings[key] = cleanedWorkflow.settings[key];
|
||||
}
|
||||
}
|
||||
cleanedWorkflow.settings = filteredSettings;
|
||||
delete cleanedWorkflow.settings;
|
||||
}
|
||||
|
||||
return cleanedWorkflow;
|
||||
|
||||
Reference in New Issue
Block a user