Skip to content

vercel: env pull cannot handle values containing double quotes #5

@exisz

Description

@exisz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions