Commit graph

50 commits

Author SHA1 Message Date
Omar Ajoue d90acdf863
Implement timeout for subworkflows (#1751) 2021-05-07 19:06:26 -05:00
Jan Oberhauser f324fe1dff 🐛 Fix Error-Workflows 2021-05-05 15:18:14 -05:00
Omar Ajoue c972f3dd50
Added logging to n8n (#1381)
* Added logging to n8n

This commit adds logging to n8n using the Winston library.

For now, this commit only allows logging to console (default behavior)
or file (need to pass in config via environment variables).

Other logging methods can be further implemented using hooks. These were
skipped for now as it would require adding more dependencies.

Logging level is notice by default, meaning no additional messages would
be displayed at the moment. Logging level can be set to info or debug as
well to enrich the generated logs.

The ILogger interface was added to the workflow project as it would make
it available for all other projects but the implementation was done on
the cli project.

* Lint fixes and logging level naming. Also fixed the way we use the logger as it was not working previously

* Improvements to logging framework

Using appropriate single quotes
Improving the way the logger is declared

* Improved naming for Log Types

* Removed logger global variable, replacing it by a proxy

* Add logging to CLI commands

* Remove unused GenericHelpers

* Changed back some messages to console instead of logger and added npm
shortcuts for worker and webhook

* Fix typos

* Adding basic file rotation to logs as suggested by @mutdmour

* Fixed linting issues

* Correcting comment to correctly reflect space usage

* Added settings for log files rotation

* Correcting config type from String to Number

* Changed default file settings to number

To reflect previous changes to the type

* Changed the way log messages are added to be called statically. Also minor naming improvements

* Applying latest corrections sent by @ivov

*  Some logging improvements

* Saving logs to a folder inside n8n home instead of root

* Fixed broken tests and linting

* Changed some log messages to improve formatting

* Adding quotes to names  on log messages

* Added execution and session IDs to logs. Also removed unnecessary line breaks

*  Added file caller to log messages (#1657)

This is done using callsites library which already existed
in the project as another library's dependency. So in fact
it does not add any new dependency.

* Adding logs to help debug Salesforce node

*  Add function name to logs and add more logs

*  Improve some error messages

*  Improve some more log messages

*  Rename logging env variables to match others

Co-authored-by: dali <servfrdali@yahoo.fr>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2021-05-01 22:43:01 -05:00
Omar Ajoue 0c779de704
Implement timeout for workers and corrected timeout for subworkflows (#1634)
* Implemented timeout for workers and corrected timeout for subworkflows

* Fixed issue with timeouts when running on separate processes

* Standardized timeouts across all n8n

Now the maxTimeout setting takes effect whenever a timeout is set
to any workflows.

This causes local timeouts (either set on a per-workflow basis or
via global settings) to be capped by the maximum timeout. This
behavior already existed but was not applied to all places.

Also changed the way n8n enforces timeouts for subworkflows, making
it work always.

In effect, with this change, if you have one workflow that calls others
only the main workflow's timeout is taken into consideration, limiting
the maximum time that other workflows combined can run.

*  Fix timeout problem in "own" mode

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2021-04-17 16:44:07 +02:00
Iván Ovejero 1d27a9e87e
Improve node error handling (#1309)
* Add path mapping and response error interfaces

* Add error handling and throwing functionality

* Refactor error handling into a single function

* Re-implement error handling in Hacker News node

* Fix linting details

* Re-implement error handling in Spotify node

* Re-implement error handling in G Suite Admin node

* 🚧 create basic setup NodeError

* 🚧 add httpCodes

* 🚧 add path priolist

* 🚧 handle statusCode in error, adjust interfaces

* 🚧 fixing type issues w/Ivan

* 🚧 add error exploration

* 👔 fix linter issues

* 🔧 improve object check

* 🚧 remove path passing from NodeApiError

* 🚧 add multi error + refactor findProperty method

* 👔 allow any

* 🔧 handle multi error message callback

*  change return type of callback

*  add customCallback to MultiError

* 🚧 refactor to use INode

* 🔨 handle arrays, continue search after first null property found

* 🚫 refactor method access

* 🚧 setup NodeErrorView

*  change timestamp to Date.now

* 📚 Add documentation for methods and constants

* 🚧 change message setting

* 🚚 move NodeErrors to workflow

*  add new ErrorView for Nodes

* 🎨 improve error notification

* 🎨 refactor interfaces

*  add WorkflowOperationError, refactor error throwing

* 👕 fix linter issues

* 🎨 rename param

* 🐛 fix handling normal errors

*  add usage of NodeApiError

* 🎨 fix throw new error instead of constructor

* 🎨 remove unnecessary code/comments

* 🎨 adjusted spacing + updated status messages

* 🎨 fix tab indentation

*  Replace current errors with custom errors (#1576)

*  Introduce NodeApiError in catch blocks

*  Introduce NodeOperationError in nodes

*  Add missing errors and remove incompatible

*  Fix NodeOperationError in incompatible nodes

* 🔧 Adjust error handling in missed nodes

PayPal, FileMaker, Reddit, Taiga and Facebook Graph API nodes

* 🔨 Adjust Strava Trigger node error handling

* 🔨 Adjust AWS nodes error handling

* 🔨 Remove duplicate instantiation of NodeApiError

* 🐛 fix strava trigger node error handling

* Add XML parsing to NodeApiError constructor (#1633)

* 🐛 Remove type annotation from catch variable

*  Add XML parsing to NodeApiError

*  Simplify error handling in Rekognition node

*  Pass in XML flag in generic functions

* 🔥 Remove try/catch wrappers at call sites

* 🔨 Refactor setting description from XML

* 🔨 Refactor let to const in resource loaders

*  Find property in parsed XML

*  Change let to const

* 🔥 Remove unneeded try/catch block

* 👕 Fix linting issues

* 🐛 Fix errors from merge conflict resolution

*  Add custom errors to latest contributions

* 👕 Fix linting issues

*  Refactor MongoDB helpers for custom errors

* 🐛 Correct custom error type

*  Apply feedback to A nodes

*  Apply feedback to missed A node

*  Apply feedback to B-D nodes

*  Apply feedback to E-F nodes

*  Apply feedback to G nodes

*  Apply feedback to H-L nodes

*  Apply feedback to M nodes

*  Apply feedback to P nodes

*  Apply feedback to R nodes

*  Apply feedback to S nodes

*  Apply feedback to T nodes

*  Apply feedback to V-Z nodes

*  Add HTTP code to iterable node error

* 🔨 Standardize e as error

* 🔨 Standardize err as error

*  Fix error handling for non-standard nodes

Co-authored-by: Ben Hesseldieck <b.hesseldieck@gmail.com>

Co-authored-by: Ben Hesseldieck <b.hesseldieck@gmail.com>
Co-authored-by: Ben Hesseldieck <1849459+BHesseldieck@users.noreply.github.com>
2021-04-16 18:33:36 +02:00
Omar Ajoue 53a20dddce
🐛 Fix issue with subworkflows running on main process (#1557) 2021-03-19 15:18:35 +01:00
Omar Ajoue d6d57c2df6
🐛 Fixed an issue with queue mode for executions that should not be saved (#1509)
* Fixed an issue with queue mode for executions that should not be saved

*  Minimal change

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2021-03-10 15:51:18 +01:00
Omar Ajoue 3d80129a28
🐛 Fix performance and crashes with latest updates (#1524)
* Removing unnecessary data from process communication

* Wrapping progress save in a try ... catch block to prevent crashes

* Migration to fix mysql problems with big data on executions

*  Minor formatting fixes

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2021-03-10 10:50:07 +01:00
Omar Ajoue 66a345ea94
🐛 Fix issue with auto refresh on execution list (#1475)
* Fix issue with auto refresh on execution list

When auto refresh is on, we used to get executions from backend using
the firstId field to filter recent executions.

This is a problem when you have executions that do not finish in order,
leaving gaps behind. This PR fixes this problem by refreshing the latest
30 executions and correctly adding them to the list.

* Fixed an issues with auto refresh on executions ExecutionsList

Fixed two bugs, one in frontend which was ignoring the first returned
row from the backend and an issue with backend that was not using
the overriden version of `executeWorkflow` function for sub sub
workflows.

* Fixed the display of manual executions when running with queues and improved display of subworkflows

* Changing workflow ids array from variable to constant

* Added unknown status to workflow execution and changed its color to orange
2021-03-03 08:31:55 +01:00
Omar Ajoue 6ee9501d16
🐛 Fixing execution history for integrated workflows. (#1469)
* Fixing execution history for integrated workflows.

*  Minor improvements

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2021-02-20 13:51:06 +01:00
Jan Oberhauser deaa015e61 Do only send manual executions to starting session & cleanup 2021-02-13 20:40:27 +01:00
Omar Ajoue e53efdd337
Separate webhooks from core (#1408)
* Unify execution ID across executions

* Fix indentation and improved comments

* WIP: saving data after each node execution

* Added on/off to save data after each step, saving initial data and retries working

* Fixing lint issues

* Fixing more lint issues

*  Add bull to execute workflows

* 👕 Fix lint issue

*  Add graceful shutdown to worker

*  Add loading staticData to worker

* 👕 Fix lint issue

*  Fix import

* Changed tables metadata to add nullable to stoppedAt

* Reload database on migration run

* Fixed reloading database schema for sqlite by reconnecting and fixing postgres migration

* Added checks to Redis and exiting process if connection is unavailable

* Fixing error with new installations

* Fix issue with data not being sent back to browser on manual executions with defined destination

* Merging bull and unify execution id branch fixes

* Main process will now get execution success from database instead of redis

* Omit execution duration if execution did not stop

* Fix issue with execution list displaying inconsistant information information while a workflow is running

* Remove unused hooks to clarify for developers that these wont run in queue mode

* Added active pooling to help recover from Redis crashes

* Lint issues

* Changing default polling interval to 60 seconds

* Removed unnecessary attributes from bull job

* Added webhooks service and setting to disable webhooks from main process

* Fixed executions list when running with queues. Now we get the list of actively running workflows from bull.

* Add option to disable deregistration of webhooks on shutdown

* Rename WEBHOOK_TUNNEL_URL to WEBHOOK_URL keeping backwards compat.

* Added auto refresh to executions list

* Improvements to workflow stop process when running with queues

* Refactor queue system to use a singleton and avoid code duplication

* Improve comments and remove unnecessary commits

* Remove console.log from vue file

* Blocking webhook process to run without queues

* Handling execution stop graciously when possible

* Removing initialization of all workflows from webhook process

* Refactoring code to remove code duplication for job stop

* Improved execution list to be more fluid and less intrusive

* Fixing workflow name for current executions when auto updating

*  Right align autorefresh checkbox

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2021-02-09 23:32:40 +01:00
Omar Ajoue 7a3aaf8a24
Unify execution id + Queue system (#1340)
* Unify execution ID across executions

* Fix indentation and improved comments

* WIP: saving data after each node execution

* Added on/off to save data after each step, saving initial data and retries working

* Fixing lint issues

* Fixing more lint issues

*  Add bull to execute workflows

* 👕 Fix lint issue

*  Add graceful shutdown to worker

*  Add loading staticData to worker

* 👕 Fix lint issue

*  Fix import

* Changed tables metadata to add nullable to stoppedAt

* Reload database on migration run

* Fixed reloading database schema for sqlite by reconnecting and fixing postgres migration

* Added checks to Redis and exiting process if connection is unavailable

* Fixing error with new installations

* Fix issue with data not being sent back to browser on manual executions with defined destination

* Merging bull and unify execution id branch fixes

* Main process will now get execution success from database instead of redis

* Omit execution duration if execution did not stop

* Fix issue with execution list displaying inconsistant information information while a workflow is running

* Remove unused hooks to clarify for developers that these wont run in queue mode

* Added active pooling to help recover from Redis crashes

* Lint issues

* Changing default polling interval to 60 seconds

* Removed unnecessary attributes from bull job

*  Improved output on worker job start

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2021-02-09 08:59:32 +01:00
Jan Oberhauser 7cdbe5c147 👕 Fix lint issue 2020-12-12 20:59:17 +01:00
Jan Oberhauser d306be8099 🐛 Fix bug in own error-workflow addition 2020-12-12 18:41:11 +01:00
lublak 8b567c20b9
Allow workflow to trigger on own error trigger (#1205)
* allow workflow to trigger on own error trigger

* use config errorTriggerType instance of a static string

* don't trigger twice
2020-12-12 18:36:47 +01:00
Ben Hesseldieck f2666e92ff
Add preExecuteHooks (#1151)
*  Save initital data on hook error

* 🚧 update function interface

* 🚧 response webhook with error, 🐛 fix adding preExecutionHooks to hooks

* 🔥 remove execute hook

*  execute preExecute hooks on integrated workflows

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2020-11-13 23:31:27 +01:00
Jan Oberhauser 40c2acd77b 👕 Fix lint issue 2020-10-22 15:46:03 +02:00
Jan Oberhauser 70435b582a Add hook which gets called after a workflow execution 2020-10-20 19:01:40 +02:00
Jan Oberhauser 8bfc5a4b65 Small improvements on execution pruning 2020-07-12 12:49:42 +02:00
Ben Hesseldieck b956444c0e 🐎 pruning execution data complete 2020-07-09 16:52:38 +02:00
Ben Hesseldieck 05507fc19b 🎉 basic throtteling with cleaning logs 2020-07-09 15:17:47 +02:00
Jan Oberhauser d72a711957 🐛 Fix credential issue with ExecuteWorkflow-Node 2020-07-01 15:08:00 +02:00
Jan Oberhauser 1451f94814 🔀 Merge branch 'external-hooks' 2020-06-10 13:02:45 +02:00
Jan Oberhauser 147c50485c 🔀 Merge branch 'master' into oauth-support 2020-05-12 01:56:27 +02:00
Jan Oberhauser 6e1254fd54 Add additional external workflow hooks 2020-05-06 00:59:58 +02:00
zou wendi e4cc3a4bc9 features: support jira self-hosted server 2020-05-05 12:07:19 +08:00
Jan Oberhauser 9dd9e0d8ba 🔀 Merge branch 'master' into oauth-support 2020-04-04 17:34:10 +02:00
Jan Oberhauser 075aca9497 Add execution url on Error-Workflow trigger 2020-02-19 11:29:03 -06:00
Jan Oberhauser 70286b469e Make workflow metadata available in expresions and
node-functions
2020-02-15 17:07:01 -08:00
Jan Oberhauser eb285ef711 Make it possible to set credentials to fixed values 2020-01-25 23:48:38 -08:00
Jan Oberhauser cbf4818fea 🐛 Fix bug with credentials in integrated workflows 2020-01-20 10:22:12 -06:00
Jan Oberhauser 8228b8505f Abstract OAuth signing and make credentials extendable 2020-01-13 20:46:58 -06:00
Jan Oberhauser 629ab09135 Add additional possibilities to load workflow 2020-01-02 17:13:53 -06:00
Jan Oberhauser 8acc3c5931 Add ExecuteWorkflow-Node 2019-12-19 16:07:55 -06:00
Jan Oberhauser e3b71c2ed4 Rename function and fix styling 2019-10-20 21:42:34 +02:00
BenoitTallandier 02a7d92fc1 🔃Add unction getCurrentNodeParameters to get currents parameters in loading function 2019-10-20 20:55:49 +02:00
Jan Oberhauser 7ff5721ea2 🐛 Fix bug that it did delete static data when it did not change 2019-10-15 16:10:28 +02:00
Jan Oberhauser 542ae1e785 🐛 Fix that static data did not always get load on execution 2019-10-15 07:36:53 +02:00
Jan Oberhauser 85e8714c05 Do not call Error-Workflow in manual-mode 2019-09-23 22:05:09 +02:00
Jan Oberhauser d337cbd805 👕 Replace some double quotes with single ones 2019-09-19 14:14:37 +02:00
Jan Oberhauser 52bd08fae0 Add additional data to Error Workflow Trigger 2019-09-11 17:48:14 +02:00
Jan Oberhauser 67afc883db Replace vorpal with oclif in cli 2019-08-28 15:28:47 +02:00
Jan Oberhauser 886100eeef Improve workflow retry 2019-08-09 08:07:18 +02:00
Jan Oberhauser d59a043e3f Run workflows in own independent subprocess 2019-08-08 20:47:08 +02:00
Jan Oberhauser 2d8038669a Push active executions to clients to remove manual reload 2019-07-24 14:25:30 +02:00
Jan Oberhauser d027545986 Use convict for configuration to make n8n easier to configure 2019-07-21 19:52:57 +02:00
Jan Oberhauser a17a376d13 Make it possible to define if workflow executions should be
saved or not
2019-07-10 20:53:13 +02:00
Jan Oberhauser e00bc83f1b 🎨 Rename setting "saveManualRuns" to "saveManualExecutions" 2019-07-10 18:06:26 +02:00
Jan Oberhauser 9cb9804eee Initial commit to release 2019-06-23 12:35:23 +02:00