Skip to content

fix(desktop): inline STREAMS_URL at build time to fix packaged app crash#1367

Merged
Kitenite merged 1 commit into
mainfrom
kitenite/canary
Feb 10, 2026
Merged

fix(desktop): inline STREAMS_URL at build time to fix packaged app crash#1367
Kitenite merged 1 commit into
mainfrom
kitenite/canary

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Feb 10, 2026

Summary

  • STREAMS_URL was missing from the Vite define block in electron.vite.config.ts, so the bundled .asar still contained a raw process.env.STREAMS_URL reference that resolves to undefined at runtime on users' machines
  • The build succeeded because dotenv loads the var at build time and the Zod validation import passes — but Vite only inlines values explicitly listed in define
  • Follows up on fix(ci): add missing STREAMS_URL to desktop build workflow #1364 which added the env var to CI but didn't address the bundling gap

Changes

  • electron.vite.config.ts — Add process.env.STREAMS_URL to the main.define block with production fallback
  • env.main.ts — Add .default() to the Zod schema as a safety net

Test Plan

  • Build desktop app (bun run build --filter=@superset/desktop)
  • Launch packaged Canary — should no longer crash with "Invalid environment variables"
  • Verify streams/AI chat functionality works with the inlined URL

Summary by CodeRabbit

  • Chores
    • Simplified configuration by providing a default streaming service endpoint, eliminating the need for manual setup.

STREAMS_URL was missing from the Vite define block, so the bundled app
still referenced process.env.STREAMS_URL at runtime where it's undefined.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

Adds STREAMS_URL environment variable injection to the Electron build configuration with a default value of "https://superset-stream.fly.dev", and makes the variable optional in the main process environment schema with the same default fallback.

Changes

Cohort / File(s) Summary
Environment Variable Configuration
apps/desktop/electron.vite.config.ts, apps/desktop/src/main/env.main.ts
Added STREAMS_URL environment variable injection in the Vite build config define block and made it optional with a default value in the main process environment schema.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 A little stream URL now has a home,
With defaults so cozy wherever we roam,
No more undefined, no more despair,
The config flows smoothly through the air! 💨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing a build-time inlining issue for STREAMS_URL that was causing the packaged desktop app to crash. It directly relates to the primary objective of the PR.
Description check ✅ Passed The description provides a clear summary of the problem, detailed explanation of why it occurred, specific file changes, and a test plan. It covers all key information needed to understand the fix, though the description format differs slightly from the template structure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kitenite/canary

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
apps/desktop/src/main/env.main.ts (1)

22-22: Duplicated default URL string across files.

The default "https://superset-stream.fly.dev" is hardcoded here and again in electron.vite.config.ts (Line 75). Consider extracting it to a shared constant (e.g., in vite/helpers.ts or a constants file) so the two definitions can't drift apart.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kitenite Kitenite merged commit 0d4c4b0 into main Feb 10, 2026
6 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app
  • ⚠️ Streams Fly.io app

Thank you for your contribution! 🎉

@Kitenite Kitenite deleted the kitenite/canary branch February 10, 2026 19:14
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