Skip to content

fix: surface expired Meta connect sessions - #1183

Open
baokimho wants to merge 1 commit into
ChatbotXIO:mainfrom
baokimho:fix/meta-picker-session-expired
Open

baokimho wants to merge 1 commit into
ChatbotXIO:mainfrom
baokimho:fix/meta-picker-session-expired

Conversation

@baokimho

Copy link
Copy Markdown

Summary

Fixes the silent redirect that occurs when a Meta account-picker connect session is missing, expired, or invalid.

Previously, Messenger, Instagram, and Instagram-via-Facebook select pages redirected users back to /channels/create without explaining why the connection flow stopped.

This change preserves the existing sessionExpired reason in the redirect so /channels/create can display the already translated session-expired alert.

Changes

  • Added sessionExpired to CREATE_CHANNEL_ERROR_MESSAGE_KEYS.

  • Updated missing pending-auth redirects for:

    • Messenger
    • Instagram
    • Instagram via Facebook
  • Reused the existing translation:
    channels.connectMany.sessionError.sessionExpired

  • Updated focused tests for the affected redirects and error-code mapping.

Behavior

Before:

missing/expired pending auth
→ /channels/create
→ no explanation shown

After:

missing/expired pending auth
→ /channels/create?error=sessionExpired
→ "Your session expired. Please reconnect."

Instagram provider lookup

The existing getInstagramAccount() === null path remains unchanged and still redirects to /channels/create without sessionExpired.

That result can represent unsupported account types or provider/API failures, so it should not be classified as an expired connect session.

Validation

  • TypeScript check: passed
  • git diff --check: passed
  • Focused Vitest: blocked before test collection by a local @vitest/pretty-format dependency mismatch
  • Lint: blocked by the local pnpm/runtime environment

No application test failures were observed because Vitest did not reach test collection.

Fixes #1156

Copilot AI lite review requested due to automatic review settings September 14, 2026 23:47
@github-actions github-actions Bot added the bug Something isn't working as expected label Sep 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Focused tests and lint were blocked by the local environment.

Pull request overview

Surfaces expired or missing Meta connect sessions with a translated error on /channels/create.

Changes:

  • Adds the sessionExpired error mapping.
  • Updates Messenger and Instagram redirects.
  • Updates focused tests for redirects and mapping.
File summaries
File Description
apps/builder/src/lib/workspace/create-first-workspace.ts Adds the session-expired error mapping.
apps/builder/src/app/(no-sidebar)/channels/messenger/select/page.tsx Preserves the expired-session reason on redirect.
apps/builder/src/app/(no-sidebar)/channels/instagram/select/page.tsx Preserves the expired-session reason on redirect.
apps/builder/src/app/(no-sidebar)/channels/instagram-facebook/select/page.tsx Preserves the expired-session reason on redirect.
apps/builder/__tests__/messenger-select-page.test.tsx Tests Messenger redirect behavior.
apps/builder/__tests__/instagram-select-page.test.tsx Tests Instagram redirect behavior.
apps/builder/__tests__/instagram-facebook-select-page.test.tsx Tests Instagram-via-Facebook redirect behavior.
apps/builder/__tests__/create-first-workspace.test.ts Tests the new error mapping.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected

Projects

None yet

2 participants