RocketChat/Rocket.Chat · error · Error
error-invalid-webhook-response
Error message
error-invalid-webhook-response
What it means
Thrown as Error('error-invalid-webhook-response') in the livechat webhook test handler when the outbound fetch to the configured webhookUrl either throws or returns a non-200 status. The catch wraps any network error AND the explicit 'Invalid status code' throw into the same generic error, so the original cause is only in the logger.error output.
Source
Thrown at apps/meteor/server/api/v1/omnichannel/webhooks.ts:91
if (!webhookUrl) {
return API.v1.failure('Webhook_URL_not_set');
}
try {
logger.debug({ msg: 'Testing webhook', webhookUrl });
const request = await fetch(webhookUrl, options);
const response = await request.text();
logger.debug({ msg: 'Webhook response', response });
if (request.status === 200) {
return API.v1.success();
}
throw new Error('Invalid status code');
} catch (error) {
logger.error({ msg: 'Error testing webhook', err: error });
throw new Error('error-invalid-webhook-response');
}
},
},
);
View on GitHub (pinned to f9d3ec372b)
Solutions
- curl the webhookUrl from the Rocket.Chat host with the same method/headers to reproduce.
- Ensure the endpoint returns HTTP 200 on success.
- Check TLS validity and that DNS resolves from the Rocket.Chat server.
- Inspect the server log 'Error testing webhook' for the fetch error detail.
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
// verify webhook reachability from the Rocket.Chat host before saving
try {
const r = await fetch(webhookUrl, { method: 'POST', body: JSON.stringify({ test: true }) });
if (!r.ok) throw new Error(`status ${r.status}`);
} catch (e) { /* fix URL/cert/firewall before configuring */ } Type guard
null
Try / catch
try { await testWebhook(url); } catch (e) { if (e.message === 'error-invalid-webhook-response') { /* curl from server host, check TLS/DNS/status */ } } Prevention
- curl the webhook from the Rocket.Chat host with the real payload first.
- Ensure the endpoint returns HTTP 200 on success.
- Validate TLS chain and DNS resolution from the server.
When it happens
Trigger: POSTing the webhook test with a URL that is unreachable, returns 4xx/5xx, has an invalid TLS cert, or times out; the webhook endpoint is up but responds with a non-200 success indicator.
Common situations: Webhook URL misconfigured (HTTP vs HTTPS, wrong port); webhook server behind a firewall blocking the Rocket.Chat host; self-signed cert not trusted; webhook expects a different auth header and returns 401/403.
Related errors
- error-registering-provider
- error-unregistering-provider
- error-invalid-actionlink
- error-contact-not-found
- error-action-not-allowed
AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12).
Data as JSON: /api/errors/161f38b1745d3147.
Report an issue: GitHub.