Skip to content

fix: Fix Vercel deployment routing and theme detection#681

Open
inoribea wants to merge 1 commit intoDooy:mainfrom
inoribea:feat/vercel-deployment-fix
Open

fix: Fix Vercel deployment routing and theme detection#681
inoribea wants to merge 1 commit intoDooy:mainfrom
inoribea:feat/vercel-deployment-fix

Conversation

@inoribea
Copy link
Copy Markdown

Summary

Fix critical issues in Vercel deployment: missing API route mappings and incorrect theme detection when SYS_THEME=auto.

Changes

1. Vercel Routing Fixes (vercel.json)

Add missing API route mappings to ensure all services work properly in Vercel deployment:

  • ✅ Add /session/api/session mapping
  • ✅ Add /sunoapi/*/api/proxy mapping (Suno music generation)
  • ✅ Add /luma/*/api/proxy mapping (Luma video generation)
  • ✅ Add /viggle/*/api/proxy mapping (Viggle dance video)
  • ✅ Add /runwayml/*/api/proxy mapping (Runway video generation)

2. Theme Detection Fix (src/store/modules/auth/index.ts)

Fix SYS_THEME=auto being incorrectly forced to dark theme:

Behavior:

  • ✅ SYS_THEME=auto → Keeps auto mode, follows system prefers-color-scheme
  • ✅ SYS_THEME=light → Forces light theme
  • ✅ SYS_THEME=dark → Forces dark theme
  • ✅ No SYS_THEME or invalid value → Defaults to dark theme
  1. Environment Variables (api/session.js)

Add support for additional environment variables in Vercel deployment:

  • ✅ OPENAI_API_BASE_URL - Custom OpenAI API endpoint
  • ✅ MJ_SERVER - Custom Midjourney API endpoint
  • ✅ BACKGROUND_IMAGE - Custom background image URL
  • ✅ Code formatting cleanup (remove trailing spaces)

Why These Changes Matter

Routing Issues

Without these route mappings, Vercel-deployed instances cannot:

  • Access Suno music generation features (/sunoapi/*)
  • Use Luma video generation (/luma/*)
  • Create Viggle dance videos (/viggle/*)
  • Generate Runway videos (/runwayml/*)
  • Fetch session configuration (/session)

Theme Detection Issue

The previous logic incorrectly treated SYS_THEME=auto as if it was an invalid value, forcing it to dark mode. This prevented users from using automatic theme switching based on system preferences.

Environment Variables

Vercel deployment uses api/session.js instead of service/src/index.ts, so environment variables must be explicitly added here for Vercel deployments to work correctly.

**Vercel Routing Fixes:**
- Add /session route mapping to /api/session
- Add /sunoapi/* route mapping to /api/proxy
- Add /luma/* route mapping to /api/proxy
- Add /viggle/* route mapping to /api/proxy
- Add /runwayml/* route mapping to /api/proxy
- Ensure all API endpoints are properly proxied in Vercel deployment

**Theme Detection Fix:**
- Fix SYS_THEME=auto being incorrectly detected as dark theme
- Properly handle three theme modes: auto, light, dark
- When SYS_THEME=auto, keep auto state for system preference detection
- When SYS_THEME=light or dark, force use specified theme

**Environment Variables:**
- Add OPENAI_API_BASE_URL support in api/session.js for Vercel
- Add MJ_SERVER support in api/session.js for Vercel
- Add BACKGROUND_IMAGE support in api/session.js
- Clean up code formatting (remove trailing spaces)

Note: Vercel deployment uses api/session.js instead of service/src/index.ts
@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 30, 2025

@inoribea is attempting to deploy a commit to the dooy's projects Team on Vercel.

A member of the Team first needs to authorize it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant