Skip to content

fix: packaged builds baked ZERO keys when .env has CRLF line endings - #125

Merged
nishant merged 1 commit into
masterfrom
fix/env-crlf-bake
Jul 15, 2026
Merged

nishant merged 1 commit into
masterfrom
fix/env-crlf-bake

Conversation

@nishant

@nishant nishant commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Symptom

v0.18.0 installed → YouTube auth-url 503, Spotify "no client id", Discord native "not configured" — every keyed widget dead at once.

Root cause

packages/server/build.mjs split .env on '\n'. With CRLF line endings each line keeps a trailing \r, and \r is a JS regex line terminator — (.*)$ cannot match across it, so the key=value regex failed on every line and BUILTINS_JSON baked as {}. Confirmed empirically: the v0.18.0 bundle contains no baked map; a fresh build reproduced it; the exact parse loop returns 0 keys against the CRLF .env.

Dev never showed it — dotenv parses CRLF fine. Packaged-build-only failure class.

Fix

Split on /\r?\n/. Post-fix build verified: all 11 BUILTIN_KEYS bake with non-empty values (Spotify/YouTube/Alpaca/Twitch/Discord/CoinGecko-less).

🤖 Generated with Claude Code

build.mjs split .env on '\n', leaving a trailing \r on every line under CRLF
endings - and \r is a JS regex line terminator, so the key=value regex failed
on every line and BUILTINS_JSON baked empty. Every keyed widget in the
packaged app (YouTube, Spotify, Alpaca, Twitch, Discord native) lost its
credentials at once; dev was unaffected because dotenv parses CRLF.

Split on /\r?\n/ instead. Verified: all 11 BUILTIN_KEYS bake non-empty.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@nishant
nishant merged commit d10c8f8 into master Jul 15, 2026
1 check passed
@nishant
nishant deleted the fix/env-crlf-bake branch July 15, 2026 02:32
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