{"record":{"id":"161f38b1745d3147","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-webhook-response","errorCode":null,"errorMessage":"error-invalid-webhook-response","messagePattern":"error-invalid-webhook-response","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/api/v1/omnichannel/webhooks.ts","lineNumber":91,"sourceCode":"\n\t\t\tif (!webhookUrl) {\n\t\t\t\treturn API.v1.failure('Webhook_URL_not_set');\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tlogger.debug({ msg: 'Testing webhook', webhookUrl });\n\t\t\t\tconst request = await fetch(webhookUrl, options);\n\t\t\t\tconst response = await request.text();\n\n\t\t\t\tlogger.debug({ msg: 'Webhook response', response });\n\t\t\t\tif (request.status === 200) {\n\t\t\t\t\treturn API.v1.success();\n\t\t\t\t}\n\n\t\t\t\tthrow new Error('Invalid status code');\n\t\t\t} catch (error) {\n\t\t\t\tlogger.error({ msg: 'Error testing webhook', err: error });\n\t\t\t\tthrow new Error('error-invalid-webhook-response');\n\t\t\t}\n\t\t},\n\t},\n);\n","sourceCodeStart":73,"sourceCodeEnd":96,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/server/api/v1/omnichannel/webhooks.ts#L73-L96","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"// verify webhook reachability from the Rocket.Chat host before saving\ntry {\n  const r = await fetch(webhookUrl, { method: 'POST', body: JSON.stringify({ test: true }) });\n  if (!r.ok) throw new Error(`status ${r.status}`);\n} catch (e) { /* fix URL/cert/firewall before configuring */ }","typeGuard":"null","tryCatchPattern":"try { await testWebhook(url); } catch (e) { if (e.message === 'error-invalid-webhook-response') { /* curl from server host, check TLS/DNS/status */ } }","preventionTips":["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."],"tags":["omnichannel","webhook","network","integration","testing"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}