fix: packaged builds baked ZERO keys when .env has CRLF line endings - #125
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.mjssplit.envon'\n'. With CRLF line endings each line keeps a trailing\r, and\ris a JS regex line terminator —(.*)$cannot match across it, so thekey=valueregex failed on every line andBUILTINS_JSONbaked 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