Custom Node webhook returns ECONNREFUSED

I’m having problems with webhook custom function. I’d like to execute these commands here:

  async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
    const bodyData = this.getBodyData();
		const message = bodyData.message;
		const jid = bodyData.jid;

		await this.helpers.request({
			method: "POST",
			uri: 'http://localhost:3002/text-message',
			body: { message, jid },
			headers: { 'Content-Type': 'application/json' }
		});
		
    return {
      workflowData: [this.helpers.returnJsonArray(bodyData)],
    };
  }

How can I stop to return these ECONNREFUSED? I’m not inheriting any function of webhookMethods.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @megarubber ! Looks like localhost resolves to the IPv6 address ::1. What you probably want is a IPv4 address. Try setting the uri to http://127.0.0.1:3002/text-message.

1 Like