Skip to content

fix(secrets): secrets set -f - waits for a piped writer instead of failing with EAGAIN - #15

Merged
boyander merged 1 commit into
mainfrom
fix/secrets-set-stdin-eagain
Oct 14, 2026
Merged

boyander merged 1 commit into
mainfrom
fix/secrets-set-stdin-eagain

Conversation

@boyander

Copy link
Copy Markdown
Member

faable auth webhooks create --json | … | faable deploy secrets set -f - failed with EAGAIN: resource temporarily unavailable, read, which lost a webhook secret that is shown only once (it had to be rotated).

Cause: the CLI touches process.stdin early (the TTY check), which puts fd 0 in non-blocking mode. readFileSync(0) on a pipe whose writer has not written yet then throws instead of waiting.

Fix: read stdin asynchronously, with the helper auth users suspend/reinstate already used, moved to lib/stdin.ts.

Tests

  • stdin.test.ts spawns a reader that touches stdin first, with a writer that is 500 ms late. read_stdin gets the data; a second test pins that readFileSync(0) throws EAGAIN in the same setup.
  • Real run against a Staff canary app, with a test secret removed afterwards: (sleep 2; echo X=1) | faable deploy secrets set -f - fails on 4.10.0 and works with this branch.

…failing with EAGAIN

`faable auth webhooks create --json | … | faable deploy secrets set -f -`
failed with "EAGAIN: resource temporarily unavailable, read". The CLI
touches process.stdin early (the TTY check), which makes fd 0
non-blocking, and readFileSync(0) on a pipe whose writer has not written
yet throws instead of waiting. stdin is now read asynchronously, with the
helper the auth user commands already used (moved to lib/stdin.ts).
@boyander
boyander merged commit 0d30a95 into main Oct 14, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.10.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@boyander
boyander deleted the fix/secrets-set-stdin-eagain branch October 14, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant