Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): Prevent creation of input connections for nodes without input slot #5425

Merged
merged 11 commits into from
Feb 9, 2023

Conversation

OlegIvaniv
Copy link
Contributor

@OlegIvaniv OlegIvaniv commented Feb 9, 2023

In the recent changes to __addConnection we've changed the previous if/else condition to just if. Doing this, the this.workflowsStore.addConnection({ connection }); call would always be executed no matter if the connection could be made or not. So when a user would have selected a regular node and added a trigger node, these would be connected even though the trigger node has no inputs.
This PR fixes it by removing this call completely since addVisualConnection parameter is always sent with true anyway. Without forcing this.workflowsStore.addConnection call, the connection will be made only if the target node has a valid input.

For already broken workflows, there is migration that will detect corrupted connections and purge them.

Github issue / Community forum post (link here to close automatically): https://community.n8n.io/t/schedule-trigger-node-is-getting-triggered-multiple-times-during-a-workflow/22822

@OlegIvaniv OlegIvaniv self-assigned this Feb 9, 2023
@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Feb 9, 2023
@@ -239,6 +239,14 @@ export class Start extends Command {
const { flags } = this.parse(Start);

try {
// Load all node and credential types
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had to move the loading of nodes and credentials up to make sure they are available in the migrations. @netroy Do you see any issues with this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fine. I don't foresee any issues.

@krynble
Copy link
Contributor

krynble commented Feb 9, 2023

Another thing we could do is remove the duplicate code off the migration files to a helper function, but this is not urgent. It won't be reused so it's fine.

@OlegIvaniv OlegIvaniv requested a review from krynble February 9, 2023 14:05
@OlegIvaniv OlegIvaniv merged commit 018f8a3 into master Feb 9, 2023
@OlegIvaniv OlegIvaniv deleted the n8n-6132-bug-phantom-splitinbatches-executions branch February 9, 2023 15:04
@n8n-assistant n8n-assistant bot added the Upcoming Release Will be part of the upcoming release label Feb 9, 2023
janober pushed a commit that referenced this pull request Feb 9, 2023
…input slot (#5425)

* fix(editor): Prevent creation of input connections for nodes without input

* WIP: Workflow checks service and controller

* fix: Created SQLite migration to remove broken connections

* Cleanup & add mysql/posgres migrations

* Linter fixes

* Unify the migration scripts

* Escape migration workflow_entity

* Wrap the migration in try/catch and do not parse nodes and connection if mysql/postgres

* Do migration changes also fro mysql

* refactor: Wrap only the necessary call in try catch block

---------

Co-authored-by: Omar Ajoue <krynble@gmail.com>
janober pushed a commit that referenced this pull request Feb 9, 2023
…input slot (#5425)

* fix(editor): Prevent creation of input connections for nodes without input

* WIP: Workflow checks service and controller

* fix: Created SQLite migration to remove broken connections

* Cleanup & add mysql/posgres migrations

* Linter fixes

* Unify the migration scripts

* Escape migration workflow_entity

* Wrap the migration in try/catch and do not parse nodes and connection if mysql/postgres

* Do migration changes also fro mysql

* refactor: Wrap only the necessary call in try catch block

---------

Co-authored-by: Omar Ajoue <krynble@gmail.com>
@janober
Copy link
Member

janober commented Feb 9, 2023

Got released with n8n@0.214.3

@janober janober removed the Upcoming Release Will be part of the upcoming release label Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants