fix: strip API-only settings before workflow create/update#30
Open
avi90210 wants to merge 1 commit intoubie-oss:mainfrom
Open
fix: strip API-only settings before workflow create/update#30avi90210 wants to merge 1 commit intoubie-oss:mainfrom
avi90210 wants to merge 1 commit intoubie-oss:mainfrom
Conversation
n8n's API exports `availableInMCP`, `binaryMode`, and `callerPolicy` in workflow settings on GET, but rejects them on PUT/PATCH with "request/body/settings must NOT have additional properties". This causes `apply` to fail when pushing workflows that were previously imported, since the imported YAML contains these server-side settings. Strip these known API-only properties before sending create/update requests, matching the existing pattern for `pinData`.
Contributor
|
@avi90210 fix the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
availableInMCP,binaryMode, andcallerPolicyfrom workflow settings before sending create/update API requestsrequest/body/settings must NOT have additional propertiespinDatais already excluded from the request bodyProblem
When using
n8n-cli importfollowed byn8n-cli apply, the imported YAML contains server-side settings that the API rejects on write. This forces users to manually strip these fields before pushing.Fix
Added a
sanitizeSettings()method inexecutor.tsthat blacklists known API-only settings, applied in bothexecuteCreate()andexecuteUpdate().Test plan
availableInMCP,binaryMode,callerPolicyin settingsapplysucceeds without manual field strippingapply --dry-runshows no errorsNote
Low Risk
Low risk, narrowly filters out three known
settingskeys before write requests to avoid n8n API validation errors; primary risk is unintentionally dropping a setting if the blacklist is incomplete/incorrect.Overview
Prevents
applycreate/update requests from failing due to n8n returning API-only workflowsettingsfields on read.Adds
sanitizeSettings()inExecutorto removeavailableInMCP,binaryMode, andcallerPolicy, and uses it when building theWorkflowInputfor bothexecuteCreate()andexecuteUpdate().Reviewed by Cursor Bugbot for commit 3937e3c. Bugbot is set up for automated code reviews on this repo. Configure here.