Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improvement: add fallback

Scott Wilsonbf3596cc5e6d
diff --git a/backend/src/server/routes/v1/slack-router.ts b/backend/src/server/routes/v1/slack-router.ts
index 710d82fca7..75b4d69449 100644
--- a/backend/src/server/routes/v1/slack-router.ts
+++ b/backend/src/server/routes/v1/slack-router.ts
@@ -339,7 +339,13 @@ export const registerSlackRouter = async (server: FastifyZodProvider) => {
return res.redirect(appCfg.SITE_URL as string);
},
successAsync: async (installation) => {
- const metadata = JSON.parse(installation.metadata || "{}") as { orgId: string };
+ const metadata = JSON.parse(installation.metadata || "{}") as { orgId?: string };
+
+ // Fall back to the site root (like the failure path) if orgId is missing, rather than
+ // redirecting to a broken /organizations/undefined/settings page.
+ if (!metadata.orgId) {
+ return res.redirect(appCfg.SITE_URL as string);
+ }
return res.redirect(
`${appCfg.SITE_URL}/organizations/${metadata.orgId}/settings?selectedTab=workflow-integrations`