Source: vercel/vercel#11258 (1 reaction, 2025 comment with workaround)
Pain
vercel env pull writes .env files where values containing " get malformed (e.g. JSON values, escaped strings). Breaks any downstream tool that parses .env. User in comments shipped a manual readline-based regex workaround.
Our solution
avercel env pull (override the passthrough):
Pass through to vercel for the actual fetch
Post-process the resulting .env file:
Fetch true values from REST API (GET /v9/projects/$PROJECT_ID/env)
Re-emit with proper escaping: wrap values containing ", \n, or # in single quotes; or use double quotes with proper " escaping per dotenv spec.
Add --format <dotenv|json|shell> for output flexibility (json/shell formats are pure wins — vercel CLI has no equivalent).
DoD
[ ] Value escaping handles: double quotes, single quotes, newlines, backticks, dollar signs, hash
[ ] --format json outputs proper JSON object
[ ] --format shell outputs export NAME='val' lines (proper shell escaping)
[ ] Snapshot tests with adversarial values
Migrated from NEBULA-94 | Parent: NEBULA-18 | Original status: To Do
Source: vercel/vercel#11258 (1 reaction, 2025 comment with workaround)
Pain
vercel env pull writes .env files where values containing " get malformed (e.g. JSON values, escaped strings). Breaks any downstream tool that parses .env. User in comments shipped a manual readline-based regex workaround.
Our solution
avercel env pull (override the passthrough):
Pass through to vercel for the actual fetch
Post-process the resulting .env file:
Fetch true values from REST API (GET /v9/projects/$PROJECT_ID/env)
Re-emit with proper escaping: wrap values containing ", \n, or # in single quotes; or use double quotes with proper " escaping per dotenv spec.
Add --format <dotenv|json|shell> for output flexibility (json/shell formats are pure wins — vercel CLI has no equivalent).
DoD
[ ] Value escaping handles: double quotes, single quotes, newlines, backticks, dollar signs, hash
[ ] --format json outputs proper JSON object
[ ] --format shell outputs export NAME='val' lines (proper shell escaping)
[ ] Snapshot tests with adversarial values
Migrated from NEBULA-94 | Parent: NEBULA-18 | Original status: To Do