diff --git a/packages/cli/src/config/schema.ts b/packages/cli/src/config/schema.ts index 54fa07e7f5..310d1c9ea0 100644 --- a/packages/cli/src/config/schema.ts +++ b/packages/cli/src/config/schema.ts @@ -60,6 +60,12 @@ export const schema = { default: 3600, env: 'EXECUTIONS_TIMEOUT_MAX', }, + httpTimeout: { + doc: 'Timeout for HTTP requests (seconds)', + format: Number, + default: 300, + env: 'N8N_HTTP_TIMEOUT', + }, // If a workflow executes all the data gets saved by default. This // could be a problem when a workflow gets executed a lot and processes diff --git a/packages/core/src/Constants.ts b/packages/core/src/Constants.ts index d5fc12bffd..6829df604b 100644 --- a/packages/core/src/Constants.ts +++ b/packages/core/src/Constants.ts @@ -12,3 +12,4 @@ export const CONFIG_FILES = 'N8N_CONFIG_FILES'; export const BINARY_DATA_STORAGE_PATH = 'N8N_BINARY_DATA_STORAGE_PATH'; export const UM_EMAIL_TEMPLATES_INVITE = 'N8N_UM_EMAIL_TEMPLATES_INVITE'; export const UM_EMAIL_TEMPLATES_PWRESET = 'N8N_UM_EMAIL_TEMPLATES_PWRESET'; +export const HTTP_TIMEOUT = 'N8N_HTTP_TIMEOUT'; diff --git a/packages/core/src/NodeExecuteFunctions.ts b/packages/core/src/NodeExecuteFunctions.ts index 750ff80dd9..ce134b0770 100644 --- a/packages/core/src/NodeExecuteFunctions.ts +++ b/packages/core/src/NodeExecuteFunctions.ts @@ -119,6 +119,7 @@ import { BLOCK_FILE_ACCESS_TO_N8N_FILES, CONFIG_FILES, CUSTOM_EXTENSION_ENV, + HTTP_TIMEOUT, RESTRICT_FILE_ACCESS_TO, UM_EMAIL_TEMPLATES_INVITE, UM_EMAIL_TEMPLATES_PWRESET, @@ -140,7 +141,11 @@ import { import { ScheduledTaskManager } from './ScheduledTaskManager'; import { SSHClientsManager } from './SSHClientsManager'; -axios.defaults.timeout = 300000; +// httpTimeout schema config is provided in seconds +axios.defaults.timeout = process.env[HTTP_TIMEOUT] + ? parseInt(process.env[HTTP_TIMEOUT]) * 1000 + : 300000; + // Prevent axios from adding x-form-www-urlencoded headers by default axios.defaults.headers.post = {}; axios.defaults.headers.put = {};