Skip to content

fix(runner): don't set contentType on Actor.setValue with object payload - #24

Merged
DaveHanns merged 1 commit into
chocholous:mainfrom
DaveHanns:fix/runner-started-at-setvalue-serialization
Jul 3, 2026
Merged

fix(runner): don't set contentType on Actor.setValue with object payload#24
DaveHanns merged 1 commit into
chocholous:mainfrom
DaveHanns:fix/runner-started-at-setvalue-serialization

Conversation

@DaveHanns

Copy link
Copy Markdown
Collaborator

Summary

The RUNNER-STARTED-AT KVS write introduced in PR #23 (EF2 v2 recovery, cherry-picked from stranded PR #17) crashes the runner at boot with:

ArgumentError: The "value" parameter must be a String, Buffer or Stream when "options.contentType" is specified.
    at Actor.setValue (node_modules/apify/dist/actor.js:784)
    at actors/runner/src/main.ts:238

buildRunnerStartedPayload returns an object; Apify SDK requires pre-serialized values when contentType is set.

Fix

Drop the {contentType: 'application/json'} options arg. Without options, Apify SDK auto-JSON-stringifies the object and defaults contentType to application/json — same result, no serialization mismatch.

Verified

  • Repro: run Vf9ij9PGNjKLUnwOW on task yy68NrrQ3zTQOlnDl (davehan runner, build zQSdde5VxSiiKoVoA) crashed at 13:41:41.301Z.
  • After fix: npm run build --workspaces passes; shared tests pass.
  • Post-merge, needs one more runner rebuild + a sanity run.

Generated with Claude Code (https://claude.com/claude-code)

The RUNNER-STARTED-AT KVS write in actors/runner/src/main.ts:238
crashes at boot with:

  ArgumentError: The "value" parameter must be a String, Buffer or Stream
  when "options.contentType" is specified.

Apify SDK requires: when contentType is set, value must be a
String/Buffer/Stream (pre-serialized). buildRunnerStartedPayload
returns an object.

Fix: drop the {contentType: 'application/json'} options argument
entirely. Without options, Apify SDK auto-JSON-stringifies objects
and defaults contentType to application/json — same result, no
serialization mismatch.

The bug was cherry-picked from PR chocholous#17 in PR chocholous#23 (EF2 v2 recovery)
and only surfaced when the runner was rebuilt off main and ran an
actual scenario.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@DaveHanns
DaveHanns merged commit b9fc567 into chocholous:main Jul 3, 2026
2 checks passed
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.

1 participant