mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
🐛 Fix bug with Webhook-Process
This commit is contained in:
parent
3305247984
commit
ff20a58c70
|
@ -145,6 +145,7 @@ import { TagEntity } from './databases/entities/TagEntity';
|
||||||
import { WorkflowEntity } from './databases/entities/WorkflowEntity';
|
import { WorkflowEntity } from './databases/entities/WorkflowEntity';
|
||||||
import { NameRequest } from './WorkflowHelpers';
|
import { NameRequest } from './WorkflowHelpers';
|
||||||
import { getCredentialTranslationPath, getNodeTranslationPath } from './TranslationHelpers';
|
import { getCredentialTranslationPath, getNodeTranslationPath } from './TranslationHelpers';
|
||||||
|
import { WEBHOOK_METHODS } from './WebhookHelpers';
|
||||||
|
|
||||||
require('body-parser-xml')(bodyParser);
|
require('body-parser-xml')(bodyParser);
|
||||||
|
|
||||||
|
@ -240,8 +241,6 @@ class App {
|
||||||
this.presetCredentialsLoaded = false;
|
this.presetCredentialsLoaded = false;
|
||||||
this.endpointPresetCredentials = config.get('credentials.overwrite.endpoint') as string;
|
this.endpointPresetCredentials = config.get('credentials.overwrite.endpoint') as string;
|
||||||
|
|
||||||
this.webhookMethods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];
|
|
||||||
|
|
||||||
const urlBaseWebhook = WebhookHelpers.getWebhookBaseUrl();
|
const urlBaseWebhook = WebhookHelpers.getWebhookBaseUrl();
|
||||||
|
|
||||||
const telemetrySettings: ITelemetrySettings = {
|
const telemetrySettings: ITelemetrySettings = {
|
||||||
|
@ -2737,7 +2736,7 @@ class App {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.webhookMethods.includes(method)) {
|
if (!WEBHOOK_METHODS.includes(method)) {
|
||||||
ResponseHelper.sendErrorResponse(
|
ResponseHelper.sendErrorResponse(
|
||||||
res,
|
res,
|
||||||
new Error(`The method ${method} is not supported.`),
|
new Error(`The method ${method} is not supported.`),
|
||||||
|
|
|
@ -56,6 +56,8 @@ import * as ActiveExecutions from './ActiveExecutions';
|
||||||
|
|
||||||
const activeExecutions = ActiveExecutions.getInstance();
|
const activeExecutions = ActiveExecutions.getInstance();
|
||||||
|
|
||||||
|
export const WEBHOOK_METHODS = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all the webhooks which should be created for the give workflow
|
* Returns all the webhooks which should be created for the give workflow
|
||||||
*
|
*
|
||||||
|
|
|
@ -32,6 +32,7 @@ import {
|
||||||
} from '.';
|
} from '.';
|
||||||
|
|
||||||
import * as config from '../config';
|
import * as config from '../config';
|
||||||
|
import { WEBHOOK_METHODS } from './WebhookHelpers';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-call
|
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-call
|
||||||
require('body-parser-xml')(bodyParser);
|
require('body-parser-xml')(bodyParser);
|
||||||
|
@ -70,7 +71,7 @@ export function registerProductionWebhooks() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.webhookMethods.includes(method)) {
|
if (!WEBHOOK_METHODS.includes(method)) {
|
||||||
ResponseHelper.sendErrorResponse(res, new Error(`The method ${method} is not supported.`));
|
ResponseHelper.sendErrorResponse(res, new Error(`The method ${method} is not supported.`));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +121,7 @@ export function registerProductionWebhooks() {
|
||||||
// if (method === 'OPTIONS') {
|
// if (method === 'OPTIONS') {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (!this.webhookMethods.includes(method)) {
|
if (!WEBHOOK_METHODS.includes(method)) {
|
||||||
ResponseHelper.sendErrorResponse(res, new Error(`The method ${method} is not supported.`));
|
ResponseHelper.sendErrorResponse(res, new Error(`The method ${method} is not supported.`));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue