🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix: set slack redirect uri specifically per environment (#8205)
Thorsten Spieker2c4799340f87
diff --git a/web/src/features/slack/server/oauth-handlers.ts b/web/src/features/slack/server/oauth-handlers.tsindex ca8c72fbf4..8a41e088ff 100644--- a/web/src/features/slack/server/oauth-handlers.ts+++ b/web/src/features/slack/server/oauth-handlers.ts@@ -4,6 +4,7 @@ import {parseSlackInstallationMetadata,} from "@langfuse/shared/src/server";import { logger } from "@langfuse/shared/src/server";+import { env } from "@/src/env.mjs";/*** SlackOAuthHandlers@@ -25,12 +26,22 @@ export async function handleInstallPath(// 1. Generate the OAuth URL with proper state parameter// 2. Set session cookies for state validation// 3. Render the installation page with "Add to Slack" button+ const installOptions = {+ scopes: ["channels:read", "chat:write", "chat:write.public"],+ metadata: JSON.stringify({ projectId: projectId }),+ redirectUri: `${env.NEXTAUTH_URL}/api/public/slack/oauth`,+ };++ // hack because nextjs dev server support for https is experimental+ if (env.NODE_ENV === "development") {+ installOptions.redirectUri = installOptions.redirectUri?.replace(+ "http://",+ "https://",+ );+ }return await SlackService.getInstance().getInstaller()- .handleInstallPath(req, res, undefined, {- scopes: ["channels:read", "chat:write", "chat:write.public"],- metadata: JSON.stringify({ projectId: projectId }),- });+ .handleInstallPath(req, res, undefined, installOptions);} catch (error) {logger.error("Install path handler failed", { error, projectId });throw error;@@ -67,7 +78,7 @@ export async function handleCallback(failure: async (error) => {logger.error("OAuth callback failed", { error: error.message });- throw error;+ res.status(500).json({ message: "Internal server error" });},});} catch (error) {diff --git a/web/src/pages/api/public/slack/install/index.ts b/web/src/pages/api/public/slack/install/index.tsindex dab9712028..4d0f1091cd 100644--- a/web/src/pages/api/public/slack/install/index.ts+++ b/web/src/pages/api/public/slack/install/index.ts@@ -31,11 +31,6 @@ export default async function handler(return await handleInstallPath(req, res, projectId);} catch (error) {logger.error("Install handler failed", { error });-- // Fallback response for unexpected errors- return res.status(500).json({- error: "Internal server error",- message: "Failed to handle Slack installation request",- });+ return res.status(500).json({ message: "Internal server error" });}}diff --git a/web/src/pages/api/public/slack/oauth/index.ts b/web/src/pages/api/public/slack/oauth/index.tsindex 0f8c36b932..e8221dd49b 100644--- a/web/src/pages/api/public/slack/oauth/index.ts+++ b/web/src/pages/api/public/slack/oauth/index.ts@@ -23,8 +23,6 @@ export default async function handler(return await handleCallback(req, res);} catch (error) {logger.error("OAuth callback handler failed", { error });-- // Fallback redirect on unexpected errors- return res.redirect("/settings/slack?error=unexpected_error");+ return res.status(500).json({ message: "Internal server error" });}}