mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix: Incorrect error message on calling wrong webhook method (#11093)
This commit is contained in:
parent
b925791c15
commit
d974b015d0
|
@ -47,10 +47,13 @@ export class WebhookNotFoundError extends NotFoundError {
|
||||||
) {
|
) {
|
||||||
const errorMsg = webhookNotFoundErrorMessage({ path, httpMethod, webhookMethods });
|
const errorMsg = webhookNotFoundErrorMessage({ path, httpMethod, webhookMethods });
|
||||||
|
|
||||||
const hintMsg =
|
let hintMsg = '';
|
||||||
hint === 'default'
|
if (!webhookMethods?.length) {
|
||||||
? "Click the 'Test workflow' button on the canvas, then try again. (In test mode, the webhook only works for one call after you click this button)"
|
hintMsg =
|
||||||
: "The workflow must be active for a production URL to run successfully. You can activate the workflow using the toggle in the top-right of the editor. Note that unlike test URL calls, production URL calls aren't shown on the canvas (only in the executions list)";
|
hint === 'default'
|
||||||
|
? "Click the 'Test workflow' button on the canvas, then try again. (In test mode, the webhook only works for one call after you click this button)"
|
||||||
|
: "The workflow must be active for a production URL to run successfully. You can activate the workflow using the toggle in the top-right of the editor. Note that unlike test URL calls, production URL calls aren't shown on the canvas (only in the executions list)";
|
||||||
|
}
|
||||||
|
|
||||||
super(errorMsg, hintMsg);
|
super(errorMsg, hintMsg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,8 +160,9 @@ export class LiveWebhooks implements IWebhookManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
const webhook = await this.webhookService.findWebhook(httpMethod, path);
|
const webhook = await this.webhookService.findWebhook(httpMethod, path);
|
||||||
|
const webhookMethods = await this.getWebhookMethods(path);
|
||||||
if (webhook === null) {
|
if (webhook === null) {
|
||||||
throw new WebhookNotFoundError({ path, httpMethod }, { hint: 'production' });
|
throw new WebhookNotFoundError({ path, httpMethod, webhookMethods }, { hint: 'production' });
|
||||||
}
|
}
|
||||||
|
|
||||||
return webhook;
|
return webhook;
|
||||||
|
|
Loading…
Reference in a new issue