turbo
6f88b88a - fix: treat empty environement variables as unset (#6929)

Commit
1 year ago
fix: treat empty environement variables as unset (#6929) ### Description Fixes #6921 Setting `TURBO_API` env var to an empty string results in a panic: ``` [0 olszewski@chriss-mbp] /Users/olszewski/code/vercel/turborepo $ TURBO_API= turbo_dev build --filter=docs --output-logs new-only • Packages in scope: docs • Running build in 1 packages • Remote caching enabled @turbo/workspaces:build: cache hit (outputs already on disk), suppressing logs 899e29b77bbaa6e9 docs:rss: cache hit (outputs already on disk), suppressing logs 9991721850b37e8a docs:schema: cache hit (outputs already on disk), suppressing logs 6048fc4f56a96905 @turbo/gen:build: cache hit (outputs already on disk), suppressing logs b8021fbfb2521690 docs:build: cache hit (outputs already on disk), suppressing logs 7f1f00f669ffea14 Tasks: 5 successful, 5 total Cached: 5 cached, 5 total Time: 495ms >>> FULL TURBO Oops! Turbo has crashed. A report has been written to /var/folders/3m/rxkycvgs5jgfvs0k9xcgp6km0000gn/T/report-9ec6c539-2888-430d-9f52-ecd91cf18bc9.toml Please open an issue at https://github.com/vercel/turbo/issues/new/choose and include this file WARNING failed to close spaces client ``` This is due to us expecting Go-like behavior where the empty string is the none value. We can achieve this behavior by mapping `Some("")` to `None`. I think this is a valid change for the various string type config options as the empty string is never a valid "present" value for these fields. ### Testing Instructions Added unit test to verify that we now treat empty set environment variables as `None` Quick spot check that this no longer crashes and uses the default API instead of `""`: ``` [0 olszewski@chriss-mbp] /Users/olszewski/code/vercel/turborepo $ TURBO_API= turbo_dev build --filter=docs --output-logs new-only • Packages in scope: docs • Running build in 1 packages • Remote caching enabled @turbo/workspaces:build: cache hit (outputs already on disk), suppressing logs 899e29b77bbaa6e9 docs:schema: cache hit (outputs already on disk), suppressing logs 6048fc4f56a96905 @turbo/gen:build: cache hit (outputs already on disk), suppressing logs b8021fbfb2521690 docs:rss: cache hit, suppressing logs 9991721850b37e8a docs:build: cache hit (outputs already on disk), suppressing logs 7f1f00f669ffea14 Tasks: 5 successful, 5 total Cached: 5 cached, 5 total Time: 502ms >>> FULL TURBO Run: https://vercel.com/teams/vercel/repos/turbo-monorepo/runs/space_run_EfSNkNZDvtznuFbWhHGfbv1a ``` Closes TURBO-2004
Parents
Loading