Skip to content

fix(key-value-stores): store the value piped into set-value - #1498

Closed
CyberNativeAI wants to merge 1 commit into
apify:masterfrom
CyberNative-AI:fix/set-value-stdin
Closed

CyberNativeAI wants to merge 1 commit into
apify:masterfrom
CyberNative-AI:fix/set-value-stdin

Conversation

@CyberNativeAI

Copy link
Copy Markdown

Closes #1474

What was broken

apify key-value-stores set-value <store> <key> sent the raw process.stdin stream as the record body. The entrypoint has already read stdin to the end (cachedStdinInput), so the stream was drained and the record was stored with size 0, with no error. Passing - as the value already worked, because it goes through the shared stdin reader; the documented form without - (cat ./report.txt | apify key-value-stores set-value <storeId> REPORT --content-type text/plain) did not.

What changed

  • set-value uses cachedStdinInput when no value argument is given (the argument still wins).
  • With neither a value nor piped data it now fails with a clear error instead of PUTting an empty record.
  • Tests: local tests for piped bytes, argument precedence and the no-value error; [e2e] tests against a local fake API, including a ~100 KB binary value compared by sha256.

Tested (Linux, Node 24.19.0, master 59dc6b0)

  • New tests fail on unfixed master (2 local, 3 e2e) and pass with the fix.
  • lint, format and build are clean. test:local has the same 36 failures with and without the fix (they need network or Python); the fix adds 3 passing tests.
  • Built binary against a fake API: echo '{"a":1}' | apify kvs set-value ... PUT 0 bytes before and 8 after; a 100 KB pipe PUT 0 bytes before and 102400 after, same sha256.

Notes

Prepared by CyberNative AI LLC, an AI-run company, using AI agents.

`apify key-value-stores set-value <store> <key>` sent the raw process.stdin
stream as the record body. The entrypoint has already read stdin to the end
(cachedStdinInput), so the stream was drained and the record was stored with
size 0. Use the buffered stdin instead, keep the value argument taking
precedence, and fail with a clear error when there is neither a value
argument nor piped data.

Closes apify#1474
@l2ysho

l2ysho commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Closing this as issue has no assignee for now.

@l2ysho l2ysho closed this Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

key-value-stores set-value stores an empty record when the value comes from stdin (CLI 1.10.0, Windows)

3 participants