Commit graph

9470 commits

Author SHA1 Message Date
Michael Auerswald 0c6169ee22
refactor(core): Move event and telemetry handling into workers in queue mode (#7138)
# Motivation

In Queue mode, finished executions would cause the main instance to
always pull all execution data from the database, unflatten it and then
use it to send out event log events and telemetry events, as well as
required returns to Respond to Webhook nodes etc.

This could cause OOM errors when the data was large, since it had to be
fully unpacked and transformed on the main instance’s side, using up a
lot of memory (and time).

This PR attempts to limit this behaviour to only happen in those
required cases where the data has to be forwarded to some waiting
webhook, for example.

# Changes

Execution data is only required in cases, where the active execution has
a `postExecutePromise` attached to it. These usually forward the data to
some other endpoint (e.g. a listening webhook connection).

By adding a helper `getPostExecutePromiseCount()`, we can decide that in
cases where there is nothing listening at all, there is no reason to
pull the data on the main instance.

Previously, there would always be postExecutePromises because the
telemetry events were called. Now, these have been moved into the
workers, which have been given the various InternalHooks calls to their
hook function arrays, so they themselves issue these telemetry and event
calls.

This results in all event log messages to now be logged on the worker’s
event log, as well as the worker’s eventbus being the one to send out
the events to destinations. The main event log does…pretty much nothing.

We are not logging executions on the main event log any more, because
this would require all events to be replicated 1:1 from the workers to
the main instance(s) (this IS possible and implemented, see the worker’s
`replicateToRedisEventLogFunction` - but it is not enabled to reduce the
amount of traffic over redis).

Partial events in the main log could confuse the recovery process and
would result in, ironically, the recovery corrupting the execution data
by considering them crashed.

# Refactor

I have also used the opportunity to reduce duplicate code and move some
of the hook functionality into
`packages/cli/src/executionLifecycleHooks/shared/sharedHookFunctions.ts`
in preparation for a future full refactor of the hooks
2023-09-14 07:58:15 +02:00
Csaba Tuncsik 07a6417f0f
fix(editor): Prevent duplicate creation of credential for OAuth2 (#7163)
This PR solves the issue reported in [this
ticket](https://linear.app/n8n/issue/PAY-825/click-to-connect-for-google-sheets-does-not-work-when-cred-is-not).

Basically when trying to connect OAuth2 credentials, n8n would create
the credential twice, possibly causing transaction issues.

This PR prevents n8n from firing a duplicate creation request,
effectively fixing the bug about duplicate creation.
2023-09-13 17:28:43 +02:00
Milorad FIlipović c11dfbbe00
ci: Add reusable unit test workflow (no-changelog) (#7159)
Github issue / Community forum post (link here to close automatically):

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-09-13 15:24:02 +02:00
github-actions[bot] a6e027b3ff
🚀 Release 1.7.0 (#7162)
# [1.7.0](https://github.com/n8n-io/n8n/compare/n8n@1.6.0...n8n@1.7.0)
(2023-09-13)


### Bug Fixes

* **Code Node:** Disable WASM to address CVE-2023-37903
([#7122](https://github.com/n8n-io/n8n/issues/7122))
([36a8e91](36a8e911e6))
* **Code Node:** Upgrade vm2 to address CVE-2023-37466
([#7123](https://github.com/n8n-io/n8n/issues/7123))
([0a35025](0a35025e5e))
* **core:** Disable Node.js custom inspection to address CVE-2023-37903
([#7125](https://github.com/n8n-io/n8n/issues/7125))
([a223734](a223734a4a))
* **editor** Account for nanoid workflow ids for subworkflow execute
policy ([#7094](https://github.com/n8n-io/n8n/issues/7094))
([67092c0](67092c0a1b))
* **editor:** Tweak hover area of workflow / cred cards
([#7108](https://github.com/n8n-io/n8n/issues/7108))
([217de21](217de21605))
* **editor:** Unbind workflow endpoint events in case of workspace reset
([#7129](https://github.com/n8n-io/n8n/issues/7129))
([c9b7948](c9b79485cf))
* **editor:** Update git repo url validation regex
([#7151](https://github.com/n8n-io/n8n/issues/7151))
([e51f173](e51f173608))
* **Google Cloud Firestore Node:** Fix empty string interpreted as
number ([#7136](https://github.com/n8n-io/n8n/issues/7136))
([915cfa0](915cfa0f6a))
* **HubSpot Node:** Fix issue with contact lists not working
([#5582](https://github.com/n8n-io/n8n/issues/5582))
([6e5a4f6](6e5a4f6a58))
* **Postgres Node:** Fix automatic column mapping
([#7121](https://github.com/n8n-io/n8n/issues/7121))
([92af131](92af1314fe))
* **Zoho CRM Node:** Fix issue with Sales Order not updating
([#6959](https://github.com/n8n-io/n8n/issues/6959))
([fd800b6](fd800b674b))


### Features

* **core:** Add an option to enable WAL mode for SQLite
([#7118](https://github.com/n8n-io/n8n/issues/7118))
([1d1a022](1d1a022def))
* **core:** Add commands to workers to respond with current state
([#7029](https://github.com/n8n-io/n8n/issues/7029))
([7b49cf2](7b49cf2a2c))
* **Salesforce Node:** Add fax field to lead option
([#7030](https://github.com/n8n-io/n8n/issues/7030))
([01f875a](01f875a94d))

Co-authored-by: netroy <netroy@users.noreply.github.com>
2023-09-13 14:55:52 +02:00
कारतोफ्फेलस्क्रिप्ट™ 34ebffea45
refactor(core): Move workerCommandHandler into worker.ts (no-changelog) (#7160) 2023-09-13 14:51:41 +02:00
Csaba Tuncsik 217de21605
fix(editor): Tweak hover area of workflow / cred cards (#7108)
Context

When a user is attempting to interact with a foreground action inside an
entity card (workflow, credential, community node, logging destination),
they might accidentally open that entity instead of interacting with a
foreground action.

For these card components, actions are always placed on right side. 

A/C

Area around right "column" of entity cards (workflow, cred, community
node, logging destination) should not be a hoverable area (that opens
that entity when clicked). This area is roughly highlighted in screen
shot below in orange.


![image](https://github.com/n8n-io/n8n/assets/5410822/0916bcd5-e972-4367-a862-41d2086a2334)
2023-09-13 12:21:26 +02:00
Omar Ajoue 67092c0a1b
fix: Account for nanoid workflow ids for subworkflow execute policy (#7094)
Github issue / Community forum post (link here to close automatically):

Since the change to allow workflow IDs to become strings in Nano ID
formats, this input broke.

This PR allows all characters that comprise workflow IDs.

---------

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-09-13 09:56:58 +02:00
Csaba Tuncsik c9b79485cf
fix(editor): Unbind workflow endpoint events in case of workspace reset (#7129) 2023-09-13 09:00:35 +02:00
कारतोफ्फेलस्क्रिप्ट™ 22edc03cab
fix(core): Ignore missing user-agent on bot check (no-changelog) (#7153) 2023-09-12 19:57:25 +02:00
Jon 6e5a4f6a58
fix(HubSpot Node): Fix issue with contact lists not working (#5582) 2023-09-12 17:04:39 +01:00
Quang-Linh LE 915cfa0f6a
fix(Google Cloud Firestore Node): Fix empty string interpreted as number (#7136) 2023-09-12 10:03:33 +01:00
greyliath b67a6fc432
docs(editor): Update .round() function in NumberExtensions.ts for clarity (#7150) 2023-09-12 09:24:29 +01:00
Csaba Tuncsik e51f173608
fix(editor): Update git repo url validation regex (#7151) 2023-09-11 20:54:03 +02:00
Jon fd800b674b
fix(Zoho CRM Node): Fix issue with Sales Order not updating (#6959) 2023-09-11 17:15:52 +01:00
Jon 5c6cccd4fa
docs: Add concatenate alias to Split in Batches (#7133)
Github issue / Community forum post (link here to close automatically):
2023-09-08 12:49:16 +01:00
कारतोफ्फेलस्क्रिप्ट™ 1d1a022def
feat(core): Add an option to enable WAL mode for SQLite (#7118)
https://www.sqlite.org/wal.html
2023-09-07 15:58:48 +02:00
कारतोफ्फेलस्क्रिप्ट™ 67aaad15eb
refactor(core): Use a Set for deletedProperties in AugmentObject (no-changelog) (#7131) 2023-09-07 15:07:32 +02:00
Michael Auerswald 7b49cf2a2c
feat(core): Add commands to workers to respond with current state (#7029)
This PR adds new endpoints to the REST API:
`/orchestration/worker/status` and `/orchestration/worker/id`

Currently these just trigger the return of status / ids from the workers
via the redis back channel, this still needs to be handled and passed
through to the frontend.

It also adds the eventbus to each worker, and triggers a reload of those
eventbus instances when the configuration changes on the main instances.
2023-09-07 14:44:19 +02:00
कारतोफ्फेलस्क्रिप्ट™ 0a35025e5e
fix(Code Node): Upgrade vm2 to address CVE-2023-37466 (#7123)
[GH Advisory](https://github.com/advisories/GHSA-cchq-frgv-rjh5)

Actual fix
[here](26168e6dfe).
2023-09-07 14:18:15 +02:00
Jon f07d97fa6e
docs: Add email alias to Outlook and GMail (#7127) 2023-09-07 10:42:34 +01:00
कारतोफ्फेलस्क्रिप्ट™ a223734a4a
fix(core): Disable Node.js custom inspection to address CVE-2023-37903 (#7125)
This seems like a better fix than #7122
2023-09-07 10:25:59 +02:00
MC Naveen 01f875a94d
feat(Salesforce Node): Add fax field to lead option (#7030)
Closes:
https://community.n8n.io/t/there-is-no-fax-field-in-the-saleforce-lead-cretion/29829
2023-09-07 08:07:37 +01:00
Deborah 9af626a1b3
docs: Docs links for TheHive and TheHive5 (#7124)
Github issue / Community forum post (link here to close automatically):
2023-09-07 07:49:55 +01:00
कारतोफ्फेलस्क्रिप्ट™ 92af1314fe
fix(Postgres Node): Fix automatic column mapping (#7121)
NODE-757
2023-09-06 16:32:50 +02:00
कारतोफ्फेलस्क्रिप्ट™ 36a8e911e6
fix(Code Node): Disable WASM to address CVE-2023-37903 (#7122)
[GH Advisory](https://github.com/advisories/GHSA-g644-9gfx-q4q4)
2023-09-06 16:11:39 +02:00
कारतोफ्फेलस्क्रिप्ट™ 4f203fc37e Merge tag 'n8n@1.6.0' 2023-09-06 13:39:30 +02:00
github-actions[bot] 955bd327ff
🚀 Release 1.6.0 (#7120)
# [1.6.0](https://github.com/n8n-io/n8n/compare/n8n@1.5.1...n8n@1.6.0)
(2023-09-06)


### Bug Fixes

* **core:** Add support for in-transit encryption (TLS) on Redis
connections ([#7047](https://github.com/n8n-io/n8n/issues/7047))
([a910757](a910757cc5))
* **core:** Disallow orphan executions
([#7069](https://github.com/n8n-io/n8n/issues/7069))
([8a28e98](8a28e98ec8))
* **core:** Split event bus controller into community and ee
([#7107](https://github.com/n8n-io/n8n/issues/7107))
([011ee2e](011ee2e04b))
* **editor:** Standardize save text
([#7093](https://github.com/n8n-io/n8n/issues/7093))
([58b3492](58b3492b0d))
* Ensure all new executions are saved
([#7061](https://github.com/n8n-io/n8n/issues/7061))
([b8e06d2](b8e06d245f))
* Load remote resources even if expressions in non requried parameters
resolve ([#6987](https://github.com/n8n-io/n8n/issues/6987))
([8a8d4e8](8a8d4e8bb3))
* **Postgres Node:** Connection pool of the database object has been
destroyed ([#7074](https://github.com/n8n-io/n8n/issues/7074))
([9dd5f0e](9dd5f0e579))
* **Postgres Node:** Tunnel doesn't always close
([#7087](https://github.com/n8n-io/n8n/issues/7087))
([58e55ba](58e55ba669))


### Features

* **core:** Add list query middleware to credentials
([#7041](https://github.com/n8n-io/n8n/issues/7041))
([fd78021](fd78021b68))
* **core:** Add support for floating licenses
([#7090](https://github.com/n8n-io/n8n/issues/7090))
([e26553f](e26553f198))
* **core:** Migration for soft deletions for executions
([#7088](https://github.com/n8n-io/n8n/issues/7088))
([413e0bc](413e0bccb4))
* **HTTP Request Node:** Determine binary file name from
content-disposition headers
([#7032](https://github.com/n8n-io/n8n/issues/7032))
([273d091](273d0913fe))
* **TheHive Node:** Overhaul
([#6457](https://github.com/n8n-io/n8n/issues/6457))
([73e782e](73e782e2cf))

Co-authored-by: netroy <netroy@users.noreply.github.com>
2023-09-06 13:35:31 +02:00
कारतोफ्फेलस्क्रिप्ट™ 6b06890ffe
ci: Fix master build on Nodejs 20 (no-changelog) (#7119)
[`shelljs` is broken on Nodejs
20.6](https://github.com/shelljs/shelljs/issues/1133). Until that is
resolved, we should fix the version to 20.5
2023-09-06 13:16:39 +02:00
कारतोफ्फेलस्क्रिप्ट™ 273d0913fe
feat(HTTP Request Node): Determine binary file name from content-disposition headers (#7032)
Fixes: 

https://community.n8n.io/t/http-request-node-read-filename-from-content-disposition-header-when-downloading-files/13453

https://community.n8n.io/t/read-filename-from-content-disposition-header-when-downloading-files/22192
2023-09-06 12:38:37 +02:00
Omar Ajoue 25dc4d7825
feat: Add workflow history repository files (no-changelog) (#7071) 2023-09-06 12:23:40 +02:00
कारतोफ्फेलस्क्रिप्ट™ 689a77cc87
refactor(Spreadsheet File Node): Reduce memory usage when loading CSV files (#7095)
Co-authored-by: Michael Kret <michael.k@radency.com>
2023-09-06 11:58:00 +02:00
कारतोफ्फेलस्क्रिप्ट™ 2f647974f4
refactor: Use actual nodes/credentials in cli and core tests (no-changelog) (#7115) 2023-09-06 10:23:47 +02:00
कारतोफ्फेलस्क्रिप्ट™ a910757cc5
fix(core): Add support for in-transit encryption (TLS) on Redis connections (#7047)
Fixes https://community.n8n.io/t/upgrade-from-1-1-1-to-1-2-0/30148
2023-09-05 18:18:50 +02:00
कारतोफ्फेलस्क्रिप्ट™ cc37a5046a
fix(core): Lazy-load express-openapi-validator to reduce initial memory spike (no-changelog) (#7111) 2023-09-05 14:42:14 +02:00
कारतोफ्फेलस्क्रिप्ट™ 36f246929e
ci: Fix linting (no-changelog) (#7110) 2023-09-05 14:41:56 +02:00
Iván Ovejero 0036a4726c
refactor(core): Move static data handling to workflow service (no-changelog) (#7104) 2023-09-05 13:42:31 +02:00
Michael Auerswald 011ee2e04b
fix(core): Split event bus controller into community and ee (#7107) 2023-09-05 13:32:09 +02:00
कारतोफ्फेलस्क्रिप्ट™ 6aa7b93473
refactor(core): Deprecate prepareOutputData (no-changelog) (#7091) 2023-09-05 12:59:02 +02:00
Jon c04a996fb4
fix: Change the name for checking issue template content (no-changelog) (#7101)
Github issue / Community forum post (link here to close automatically):
https://github.com/n8n-io/n8n/issues/7100
2023-09-05 10:24:07 +01:00
Iván Ovejero 3323167c91
ci: Test Postgres and MySQL on migration PRs (no-changelog) (#7102) 2023-09-05 10:58:15 +02:00
Iván Ovejero b7320f5322
refactor(core): Set up ExecutionMetadata service (no-changelog) (#7103)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-09-05 09:13:30 +02:00
कारतोफ्फेलस्क्रिप्ट™ cffda65b33
refactor(core): Add an option to use simple recovery process by default (#7097) 2023-09-04 19:58:36 +02:00
कारतोफ्फेलस्क्रिप्ट™ ee36f2d20b
refactor(core): Disable slow-query log by default (no-changelog) (#7096)
Fixes:
https://community.n8n.io/t/stop-logging-full-query-for-execution/29732

[Slack
Conversation](https://n8nio.slack.com/archives/C035KBDA917/p1693218994681939)
2023-09-04 17:59:08 +02:00
Michael Kret 73e782e2cf
feat(TheHive Node): Overhaul (#6457) 2023-09-04 18:15:52 +03:00
कारतोफ्फेलस्क्रिप्ट™ f286bd33c1
ci: Fix linting (no-changelog) (#7099) 2023-09-04 17:07:11 +02:00
Iván Ovejero 8a28e98ec8
fix(core): Disallow orphan executions (#7069)
Until https://github.com/n8n-io/n8n/pull/7061 we had an edge case where
a manual unsaved workflow when run creates an orphan execution, i.e. a
saved execution not pointing to any workflow. This execution is only
ever visible to the instance owner (even if triggered by a member), and
is wrongly stored as unfinished and crashed. This PR enforces that the
DB disallows any such executions from making it into the DB.

This is needed also for the S3 client, which will include the
`workflowId` in the path-like filename.

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-09-04 16:57:10 +02:00
Deborah 58b3492b0d
fix(editor): Standardize save text (#7093)
Github issue / Community forum post (link here to close automatically):

---------

Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
2023-09-04 15:28:30 +01:00
Cornelius Suermann e26553f198
feat(core): Add support for floating licenses (#7090)
This PR updates the license-sdk to v2.5.0 which introduces optional
support for floating licenses.
2023-09-04 15:56:20 +02:00
Iván Ovejero fd78021b68
feat(core): Add list query middleware to credentials (#7041) 2023-09-04 15:00:25 +02:00
Iván Ovejero 413e0bccb4
feat(core): Migration for soft deletions for executions (#7088)
Based on https://github.com/n8n-io/n8n/pull/7065

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-09-04 14:34:03 +02:00