mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -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 hintMsg =
|
||||
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)";
|
||||
let hintMsg = '';
|
||||
if (!webhookMethods?.length) {
|
||||
hintMsg =
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -160,8 +160,9 @@ export class LiveWebhooks implements IWebhookManager {
|
|||
}
|
||||
|
||||
const webhook = await this.webhookService.findWebhook(httpMethod, path);
|
||||
const webhookMethods = await this.getWebhookMethods(path);
|
||||
if (webhook === null) {
|
||||
throw new WebhookNotFoundError({ path, httpMethod }, { hint: 'production' });
|
||||
throw new WebhookNotFoundError({ path, httpMethod, webhookMethods }, { hint: 'production' });
|
||||
}
|
||||
|
||||
return webhook;
|
||||
|
|
Loading…
Reference in a new issue