Commit graph

84 commits

Author SHA1 Message Date
Jan cce804a534
Simplify bull error handling (#1983) 2021-07-12 10:12:45 +02:00
Jan Oberhauser c67a50069c Fix another possible issue which could cause unknown executions 2021-07-11 18:05:44 +02:00
Omar Ajoue d3da5023f0
🐛 Fix "unknown", never-end workflow and not displaying error message (#1978)
* Added try catch blocks to avoid endlessly running workflows

* Added handling for subworkflows

*  Fix one cause of "unkown" status of worklows with "main" mode

*  Fix one cause of "unkown" status of worklows with "own" mode

*  Fix one cause of "unkown" status of worklows with "queue" mode

* Saving database recovery

* 🐛 Fix issue that errors did not get saved correctly and also not
displayed

*  Save workflow timeout correctly as error

* Adding error capture to queued jobs

*  Mark canceled executions as not finished consistently across all
modes

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2021-07-10 11:34:41 +02:00
Ben Hesseldieck d3a1d3ffef
Revert " Simplify config imports in cli package (#1840)" (#1931)
This reverts commit c21c8b3369.
2021-06-23 11:20:07 +02:00
Iván Ovejero c21c8b3369
Simplify config imports in cli package (#1840)
*  Set path alias for config

*  Update config export

*  Simplify config imports

*  Update also additional imports

*  Update path in collation migration

*  Resolve aliased paths

* 👕 Fix Codacy issue

* 👕 Retry to fix Codacy issue

Co-authored-by: Jan <janober@users.noreply.github.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2021-06-22 23:18:52 +02:00
Jan 4946bfcd3e
Add functionality to send console.log messages to editor-UI (#1816)
*  Send console.log messages to editor-UI

*  Send message only to session which started workflow

*  Made it also work in own process

*  Add support for console.log UI forward also to FunctionItem Node

* 👕 Fix lint issue

* 👕 Fix linting issue

*  Improve code

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2021-05-29 13:41:25 -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
Jan Oberhauser b2e65dceff 🐛 Fix issue that workflows in main process did timeout 2021-04-20 08:55:54 +02:00
Jan Oberhauser b83c2e2a3c 👕 Fix lint issue 2021-04-17 17:23:48 +02: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 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 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
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 99f7eb2eca Apply also credential overwrites of parent and fix bug 2020-09-12 21:13:57 +02:00
Jan Oberhauser b488ae8d3a 👕 Fix lint issue 2020-07-29 14:20:31 +02:00
Ben Hesseldieck 051598d30e
Add max execution time for Workflows (#755)
* 🎉 basic setup and execution stopping

* 🚧 soft timeout for own process executions

* 🚧 add hard timeout for subprocesses

* 🚧 add soft timeout to main thread

* 🔧 set default timeout to 5 mins --> 500s

* 💡 adding documentation to configs

* 🚧 deactivate timeout by default

* 🚧 add logic of max execution timeout

*  adding timeout to settings in frontend and server

* 🎨 improve naming

* 💡 fix change in config docs

* ✔️ fixing compilation issue

* 🎨 add format for new config variables

* 👌 type cast before checking equality

*  Improve error message if NodeType is not known

* 🐳 Tag also rpi latest image

* 🐛 Fix Postgres issue with Node.js 14 #776

* 🚧 add toggle to activate workflow timeout

* 💄 improving UX of setting a timeout and its duration

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2020-07-29 14:12:54 +02:00
Jan Oberhauser 1451f94814 🔀 Merge branch 'external-hooks' 2020-06-10 13:02:45 +02:00
Jan Oberhauser 95097a8bd7 🐛 Fix issue with credentials which extend others 2020-05-16 19:22:06 +02:00
Jan Oberhauser cfe6e72440 Do not save credential default values to DB #PROD-52 2020-05-14 14:27:19 +02:00
Jan Oberhauser 6e1254fd54 Add additional external workflow hooks 2020-05-06 00:59:58 +02:00
Jan Oberhauser 3d6a75d392 Fix issue with workflows running in main process 2020-04-29 19:33:03 +02:00
Jan Oberhauser 70286b469e Make workflow metadata available in expresions and
node-functions
2020-02-15 17:07:01 -08:00
Jan Oberhauser e5ae4c77eb Change same-process-execution setting to make it future proof 2020-01-17 19:49:31 -06:00
Jan Oberhauser 95cb1b2788 Add possibility to execute workflows in same process 2020-01-17 19:34:31 -06:00
Jan Oberhauser 8acc3c5931 Add ExecuteWorkflow-Node 2019-12-19 16:07:55 -06: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 49a817b0bb 🐛 Fix bug when executing n8n from different folder 2019-08-09 13:12:00 +02:00
Jan Oberhauser d59a043e3f Run workflows in own independent subprocess 2019-08-08 20:47:08 +02:00