{"record":{"id":"eb9219bcaaa74611","repo":"langfuse/langfuse","slug":"error","errorCode":null,"errorMessage":"Error","messagePattern":"Error","errorType":"http","errorClass":null,"httpStatus":400,"severity":"warning","filePath":"web/src/features/feedback/server/feedbackHandler.ts","lineNumber":19,"sourceCode":"import { runFeedbackCorsMiddleware } from \"@/src/features/feedback/server/corsMiddleware\";\nimport { sendToSlack } from \"@/src/features/slack/server/slack-webhook\";\nimport { type NextApiRequest, type NextApiResponse } from \"next\";\nimport { logger } from \"@langfuse/shared/src/server\";\n\n// Legacy endpoint used by older self-hosted Langfuse versions.\nexport default async function feedbackApiHandler(\n  req: NextApiRequest,\n  res: NextApiResponse,\n) {\n  await runFeedbackCorsMiddleware(req, res);\n\n  try {\n    const slackResponse = await sendToSlack(req.body);\n    if (slackResponse.status === 200) {\n      res.status(200).json({ status: \"OK\" });\n    } else {\n      logger.error(slackResponse);\n      res.status(400).json({ status: \"Error\" });\n    }\n  } catch (error) {\n    logger.error(error);\n    res.status(500).json({ status: \"Error\" });\n  }\n}\n","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/langfuse/langfuse/blob/59d92c7cf365150d10b753b5a0d1708902a2ed60/web/src/features/feedback/server/feedbackHandler.ts#L1-L26","documentation":"The feedback endpoint returns 400 when forwarding feedback to Slack does not come back with status 200 — i.e. Slack's webhook rejected or errored on the request. The Slack response object is logged via logger.error before responding.","triggerScenarios":"POST /api/feedback with SLACK_WEBHOOK_URL unset/invalid (Slack returns 4xx), malformed payload for the hook, or Slack API downtime, causing sendToSlack's response status to differ from 200.","commonSituations":"Self-hosted deployments with a stale or revoked Slack incoming webhook URL, missing SLACK_WEBHOOK_URL env var, or Slack rate-limiting the hook.","solutions":["Check the web container logs — the full slackResponse (including Slack's error body) is logged","Verify SLACK_WEBHOOK_URL is set and still valid (test with curl -X POST)","Re-create the Slack incoming webhook if it was revoked and update the env var","Retry if Slack reported a transient 429/5xx"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const webhook = process.env.SLACK_WEBHOOK_URL;\nif (!webhook || !webhook.startsWith('https://hooks.slack.com/')) {\n  // skip feedback send or queue locally\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate SLACK_WEBHOOK_URL at deploy time","Treat feedback submission as best-effort; never block the user on it"],"tags":["slack","webhook","feedback","integration"],"backgroundTag":"slack-webhook-error","analyzedSha":"59d92c7cf365150d10b753b5a0d1708902a2ed60","analyzedAt":"2026-08-27T22:22:00.402Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}