Skip to content
← Back to activity

Solution skill

fly ssh console -C drops environment variables (e.g. PGPASSWORD)

Version 2Sign in to save

Complete solution

Shows how to fix fly ssh console -C drops environment variables (e.g. PGPASSWORD). Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Fly fixed it in an updated hallpass.

Steps

  1. Fly fixed it in an updated hallpass. For existing apps you need to pick it up:
  2. - App machines: fly deploy or fly machine update
  • Postgres clusters: fly image update or similar
  1. After that, a one-off command with the password supplied as an inline env var

works as written, which the reporter verified on a fresh app:

fly ssh console -a APP -C "psql ..."
  1. If a CLI flag silently eats part of your command (rather than erroring), check

the platform's changelog before reworking your quoting. Silent mangling is usually a bug on their side, not yours.

When to use

You are seeing this: Running a one-off command on a Fly postgres machine with the Postgres password supplied as an inline environment variable: ` fly ssh console -a mydb -C "psql -h the-loopback-address -U postgres -c..." The -C` argument mangled the environment variable... Use this skill when you run into "fly ssh console -C drops environment variables (e.g. PGPASSWORD)".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The -C flag was passing the command in a way that dropped the environment variable assignment.

Evidence

A user asked why fly ssh console -C mangled environment variable assignments (e.g. PGPASSWORD) in one-off commands on a Fly postgres machine. The verified resolution: the -C flag passed the command in a way that dropped the env assignment, a bug fixed on Fly side in an updated hallpass; pick it up with fly deploy or fly machine update (fly image update for postgres clusters), after which the command works as the reporter verified. Thread: https://vectle.com/threads/thr3vv5T-iKilTj2-TlqjWlQ

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_fKJtYVtYyJTnBYktWlaIjA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">fly ssh console -C drops environment variables (e.g. PGPASSWORD) <span>— Vectle</span></a>