Commit graph

1145 commits

Author SHA1 Message Date
Ricardo Espinoza b3470fd64d
fix: Error handling on forgot password page (no-changelog) (#7633)
fixes:
https://linear.app/n8n/issue/ADO-1339/fix-error-handling-on-forgot-password-page
2023-11-07 08:45:58 -05:00
Iván Ovejero f748de9567
fix(core): Ensure pruning starts only after migrations have completed (#7626)
https://linear.app/n8n/issue/PAY-986/bug-execution-pruning-timer-is-started-before-the-database-is-ready

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-11-07 13:56:01 +01:00
Iván Ovejero c857e42677
feat(core): Coordinate workflow activation in multiple main scenario in internal API (#7566)
Story: https://linear.app/n8n/issue/PAY-926

This PR coordinates workflow activation on instance startup and on
leadership change in multiple main scenario in the internal API. Part 3
on manual workflow activation and deactivation will be a separate PR.

### Part 1: Instance startup

In multi-main scenario, on starting an instance...
- [x] If the instance is the leader, it should add webhooks, triggers
and pollers.
- [x] If the instance is the follower, it should not add webhooks,
triggers or pollers.
- [x] Unit tests.

### Part 2: Leadership change 

In multi-main scenario, if the main instance leader dies…

- [x] The new main instance leader must activate all trigger- and
poller-based workflows, excluding webhook-based workflows.
- [x] The old main instance leader must deactivate all trigger- and
poller-based workflows, excluding webhook-based workflows.
- [x] Unit tests.

To test, start two instances and check behavior on startup and
leadership change:

```
EXECUTIONS_MODE=queue N8N_LEADER_SELECTION_ENABLED=true N8N_LICENSE_TENANT_ID=... N8N_LICENSE_ACTIVATION_KEY=... N8N_LOG_LEVEL=debug npm run start

EXECUTIONS_MODE=queue N8N_LEADER_SELECTION_ENABLED=true N8N_LICENSE_TENANT_ID=... N8N_LICENSE_ACTIVATION_KEY=... N8N_LOG_LEVEL=debug N8N_PORT=5679 npm run start
```
2023-11-07 13:48:48 +01:00
Iván Ovejero a994ba5e8d
fix(core): Ensure init before checking leader or follower in multi-main scenario (#7621)
This PR ensures `MultiMainInstancePublisher` is initialized before
checking if the instance is leader or follower. Followers skip license
init, license check, and pruning start and stop.
2023-11-06 12:03:35 +01:00
Ricardo Espinoza 5790e251b8
feat(core): Rate limit forgot password endpoint (#7604)
Github issue / Community forum post (link here to close automatically):

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <netroy@users.noreply.github.com>
2023-11-03 13:44:12 -04:00
कारतोफ्फेलस्क्रिप्ट™ acec9bad71
refactor(core): Convert OAuth1/OAuth2 routes to decorated controller classes (no-changelog) (#5973) 2023-11-03 17:20:54 +01:00
Tomi Turtiainen 2aa7f6375a
fix(core): Decrease reset password token expire time (#7598)
Decrease the expiration time from 1 day to 20 minutes

Github issue / Community forum post (link here to close automatically):
2023-11-03 13:32:08 +02:00
Iván Ovejero 1c77d6597f
refactor(core): Ensure only leader handles licensing in multi-main scenario (#7558)
https://linear.app/n8n/issue/PAY-953/ensure-only-main-instance-leader-handles-licensing
2023-11-02 14:16:22 +01:00
Tomi Turtiainen 7dac9ab82c
feat(core): Log executed migrations with info level (#7586)
To help debugging possible issues in startup and migrations, log the
executed migrations with log level 'info', instead of 'debug'.

Github issue / Community forum post (link here to close automatically):
2023-11-02 14:24:04 +02:00
Iván Ovejero 921d213ae5
refactor(core): Create pruning service (no-changelog) (#7564)
https://linear.app/n8n/issue/PAY-954/ensure-only-main-instance-leader-handles-pruning
2023-11-02 12:24:25 +01:00
Jon 479f90231d
fix(core): Fix issue that prevents owner logging in when using ldap (#7408)
This PR prioritises the internal email account over LDAP for the Owner.

---------

Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2023-11-01 23:02:49 -04:00
Omar Ajoue 437c95e84e
fix(core): Permission check for subworkflow properly checking for workflow settings (#7576)
The `sharing` related code is legacy that was not removed. Subworkflow
execution should check workflow settings alone, and this is now
reflected in the code.

Github issue / Community forum post (link here to close automatically):

https://community.n8n.io/t/bug-when-using-the-execute-workflow-node-when-workflow-is-shared/32207

---------

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-11-01 18:31:34 +01:00
कारतोफ्फेलस्क्रिप्ट™ 9bdb85c4ce
fix(core): Prevent executions from becoming forever running (#7569)
Fixes CP-867
Possibly also fixes PAY-323 and PAY-412
2023-11-01 13:51:13 +01:00
Michael Auerswald b350568505
fix(core): Fix data decryption on credentials import (#7560)
Due to a change, during the credentials import command, the core's
Credential object is being called through its prototype. This caused the
Credential's cipher variable to not be set, thus no cipher service being
available during import. This fix catches this edge case and provides a
fix.
2023-10-31 13:15:09 +01:00
Jan Oberhauser 655efeaf66
feat(core): Add optional Error-Output (#7460)
Add an additional optional error output to which all items get sent that
could not be processed.
![Screenshot from 2023-10-18
17-29-15](https://github.com/n8n-io/n8n/assets/6249596/e9732807-ab2b-4662-a5f6-bdff24f7ad55)

Github issue / Community forum post (link here to close automatically):
https://community.n8n.io/t/error-connector-for-nodes/3094

https://community.n8n.io/t/error-handling-at-node-level-detect-node-execution-status/26791

---------

Co-authored-by: OlegIvaniv <me@olegivaniv.com>
2023-10-30 18:42:47 +01:00
Iván Ovejero 442c73e63b
feat(core): Set up leader selection for multiple main instances (#7527)
https://linear.app/n8n/issue/PAY-933/set-up-leader-selection-for-multiple-main-instances

- [x] Set up new envs
- [x] Add config and license checks
- [x] Implement `MultiMainInstancePublisher`
- [x] Expand `RedisServicePubSubPublisher` to support
`MultiMainInstancePublisher`
- [x] Init `MultiMainInstancePublisher` on startup and destroy on
shutdown
- [x] Add to sandbox plans
- [x] Test manually

Note: This is only for setup - coordinating in reaction to leadership
changes will come in later PRs.
2023-10-30 16:22:32 +01:00
OlegIvaniv 3ab04e4f9e
ci(core): Extract local e2e run script (no-changelog) (#7551)
Github issue / Community forum post (link here to close automatically):

---------

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-10-30 11:18:51 +01:00
Iván Ovejero 233683ce1a
refactor(core): Remove webhook deregistration on shutdown flag (#7543)
Removal missing from [original
PR](https://github.com/n8n-io/n8n/pull/7515) after initial revert.
2023-10-27 18:48:21 +02:00
Iván Ovejero 6796ba75a1
refactor(core): Stop reporting to Sentry stopping execution with wrong status (no-changelog) (#7541)
https://n8nio.sentry.io/issues/4257040218/
2023-10-27 16:14:01 +02:00
कारतोफ्फेलस्क्रिप्ट™ 35bb42c1b9
refactor(core): Avoid passing around static state like default timezone (no-changelog) (#7221) 2023-10-27 14:17:52 +02:00
Iván Ovejero 62c096710f
refactor: Run lintfix (no-changelog) (#7537)
- Fix autofixable violations
- Remove unused directives
- Allow for PascalCased variables - needed for dynamically imported or
assigned classes, decorators, routers, etc.
2023-10-27 14:15:02 +02:00
Omar Ajoue 87996a1fcf
refactor(core): Stop reporting non-error to sentry (issue 4229454473) (no-changelog) (#7525)
This PR aims to stop reporting issues such as [this
one](https://n8nio.sentry.io/issues/4229454473/events/42b96bfd6a334c15a84499e981cf90eb/?project=4503924908883968).

Github issue / Community forum post (link here to close automatically):
2023-10-27 09:25:07 +02:00
Omar Ajoue 3d95b243e9
feat(core): Make queue mode settings configurable (#7526)
This PR allows users to configure the settings to Bull, possibly
reducing the errors with `maxStalledCount` and other issues, that
usually happen either when a worker crashes or when the event loop is
super busy. Increasing the lease time and the `maxStalledCount` settings
might improve UX.

Github issue / Community forum post (link here to close automatically):
2023-10-26 17:30:16 +02:00
Iván Ovejero ae8c7a635e
refactor(core)!: Remove webhook deregistration at startup and shutdown (#7515)
https://linear.app/n8n/issue/PAY-932/deprecate-flag-to-skip-webhook-deregistration-on-shutdown
2023-10-26 14:37:54 +02:00
Iván Ovejero 5477e3fb45
refactor(core): Move execution save settings into lifecycle function (no-changelog) (#7370)
Move the handling of execution save settings into a tested lifecycle
function as discussed with Omar
2023-10-26 14:35:38 +02:00
कारतोफ्फेलस्क्रिप्ट™ 1055bd3762
fix(core): Handle missing resultData in runData (#7523) 2023-10-26 13:15:19 +02:00
Iván Ovejero 742c8a8534
fix(core): Ensure execution deletion in worker lifecycle hook (#7481)
Reported by customer
[here](https://n8nio.slack.com/archives/C05PUALKZHD/p1697446945481249?thread_ts=1697196557.638169&cid=C05PUALKZHD),
apparently a very old long-standing bug for queue mode. Please review
closely as I am not familiar with queue mode.
2023-10-25 19:13:06 +02:00
कारतोफ्फेलस्क्रिप्ट™ 05586a900d
refactor(core): Make Logger a service (no-changelog) (#7494) 2023-10-25 16:35:22 +02:00
कारतोफ्फेलस्क्रिप्ट™ 0643487403 ci: Fix oclif manifest generation 2023-10-25 14:51:10 +02:00
कारतोफ्फेलस्क्रिप्ट™ 6f45298d3d
fix(core): Ensure nodes post-processors run in the correct order (#7500)
Fixes #7497
2023-10-25 13:59:38 +02:00
Val 93cfabbeac
fix(core): Fix workflow activation with history and workflow history for EE (no-changelog) (#7508)
Github issue / Community forum post (link here to close automatically):
2023-10-25 11:07:11 +01:00
Iván Ovejero 671c95760b
refactor(core): Make executions pruning more resilient (#7480)
This PR converts the hard-deletion interval to a timeout:
- to prevent the interval from not being restored when hard deletion
throws, and
- to prevent a long-running hard deletion from leading to duplicate
deletions.
2023-10-24 16:16:45 +02:00
Iván Ovejero 78243edd18
refactor(core): Make pruning via lifecycle configuration in S3 mode mandatory (#7482)
Since we do not store which executions produced binary data, for pruning
on S3 we need to query for binary data items for each execution in order
to delete them. To minimize requests to S3, allow the user to skip
pruning requests when setting TTL at bucket level.
2023-10-24 10:37:02 +02:00
Cornelius Suermann 3ef771ea38
feat: Collect usage metrics on license renewal (no-changelog) (#7486) 2023-10-23 21:39:29 +02:00
Ricardo Espinoza 774fe202bf
fix(core): Fix frontend.settings external hook execution (#7496) 2023-10-23 11:46:13 -04:00
Val 41236b7e08
fix: Save new version of the workflow instead of the previous (no-changelog) (#7428)
Github issue / Community forum post (link here to close automatically):
2023-10-23 16:30:36 +02:00
कारतोफ्फेलस्क्रिप्ट™ b6de910cbe
refactor(core): Abstract away InstanceSettings and encryptionKey into injectable services (no-changelog) (#7471)
This change ensures that things like `encryptionKey` and `instanceId`
are always available directly where they are needed, instead of passing
them around throughout the code.
2023-10-23 13:39:35 +02:00
कारतोफ्फेलस्क्रिप्ट™ 76c04815f7
fix(core): Reduce logging overhead for levels that do not output (#7479)
all current logging calls execute `callsites()` to figure out what code
tried to log. This happens even for logging methods that aren't supposed
to create any output. Under moderate load, this can take up quite a lot
of resources. This PR changes the logger to make all ignorable logging
methods a No-Op.

In a small benchmark with a simple webhook, with log-level set to
`warn`, and using `ab -c 50 -n 500
http://localhost:5678/webhook/testing`, these were the response times:

### Before

![Before](https://github.com/n8n-io/n8n/assets/196144/01680fd9-3d2a-4f7f-bb1c-5b03bd7d5bc3)

### After

![After](https://github.com/n8n-io/n8n/assets/196144/ccacb20a-48ca-455a-a8cb-098c9c0e352e)
2023-10-20 18:26:33 +02:00
Iván Ovejero 0b42d1aa71
refactor(core): Limit soft-deletions to pruning only (#7469)
Based on customer feedback, we should limit soft deletions to pruning
only, to prevent executions from piling up in very high volume cases.
2023-10-20 15:02:47 +02:00
Jon 647372be27
feat(core): Add support for oauth based service accounts with UM SMTP (#7311)
This PR adds support for using OAuth based service accounts for the User
Management SMTP connection.

Tested using a Google Service Account.
2023-10-20 11:36:40 +01:00
Iván Ovejero b50376cf52
refactor(core): Make executions pruning settings configurable (#7468) 2023-10-19 16:57:12 +02:00
कारतोफ्फेलस्क्रिप्ट™ 55c6a1b0d3
fix(core): Do not return inviteAcceptUrl in response if email was sent (#7465) 2023-10-19 13:58:06 +02:00
कारतोफ्फेलस्क्रिप्ट™ 83762e051d
fix(core): Handle gzip and deflate compressed request payloads (#7461)
NODE-870
2023-10-18 21:52:15 +02:00
Iván Ovejero 40707fa692
feat(core): Make executions pruning interval configurable (#7439) 2023-10-18 17:01:57 +02:00
Michael Kret 3ddc176dfa
feat(n8n Form Trigger Node): New node (#7130)
Github issue / Community forum post (link here to close automatically):

based on https://github.com/joffcom/n8n-nodes-form-trigger

---------

Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
2023-10-17 07:09:30 +03:00
Michael Auerswald e01b9e5ae1
fix(core): Prevent false stalled jobs in queue mode from displaying as errored (#7435)
This is related to an issue with how Bull handles stalled jobs, see
https://github.com/OptimalBits/bull/issues/1415 for reference.

CPU intensive workflows can in certain cases take a long while to finish
up, thereby blocking the thread and causing Bull queue to think the job
has stalled, even though it finished successfully. In these cases the
error handling could then overwrite the successful execution data with
the error message.
2023-10-13 16:07:08 +02:00
Iván Ovejero c6ee1e30c0
refactor(core): Add binary data S3 to telemetry (#7412)
https://n8nio.slack.com/archives/C04B1GZ4T0U/p1697033523039729
2023-10-13 13:16:43 +02:00
Michael Auerswald 45f2ef373e
fix(core): Add check that queue is defined and remove cyclic dependency (#7404)
In a rare edge case an undefined queue could be returned - this should
not happen and now an error is thrown.
Also using the opportunity to remove a cyclic dependency from the Queue.
2023-10-13 11:53:59 +02:00
Omar Ajoue 46977a2aff
fix: Prevent undefined issues when restoring binary data (#7419)
Github issue / Community forum post (link here to close automatically):

---------

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-10-12 16:41:51 +02:00
Iván Ovejero 54e900955a
refactor(core): Move frontend settings to service (no-changelog) (#7396)
Quick follow-up to https://github.com/n8n-io/n8n/pull/7283
2023-10-11 17:12:19 +02:00