Skip to content

Fix Apify integration sending actor input in nested envelope#194

Merged
louismorgner merged 2 commits into
mainfrom
fix/apify-body-envelope
Mar 31, 2026
Merged

Fix Apify integration sending actor input in nested envelope#194
louismorgner merged 2 commits into
mainfrom
fix/apify-body-envelope

Conversation

@louismorgner
Copy link
Copy Markdown
Owner

Summary

  • The gateway wrapped the Apify input param as {"input": {...}} in the request body, but Apify's run-sync-get-dataset-items endpoint expects the actor input as the top-level body. This caused every actor invocation to receive empty/default input and return nothing useful.
  • Added body_path: "." support to the gateway so a JSON param's parsed value can become the entire request body instead of being nested under its param name.
  • Applied body_path: "." to the Apify integration definition's input param.
  • Added e2e/apify_smoke_test.go with a mock test (URL templating, auth header, body structure, JSON array response) and a live API test gated on APIFY_TEST_TOKEN.

Test plan

  • TestSmoke_ApifyRunActor — mock test confirms body is sent at top level, not wrapped
  • All existing tests pass (./e2e/, ./internal/integration/, ./cmd/) — no regressions
  • TestSmoke_ApifyRunActor_LiveAPI — run with APIFY_TEST_TOKEN=<key> go test ./e2e/ -run LiveAPI -v to validate against real Apify API

🤖 Generated with Claude Code

louismorgner and others added 2 commits March 30, 2026 19:34
The gateway wrapped the `input` param as `{"input": {...}}` in the
request body, but Apify's run-sync-get-dataset-items endpoint expects
the actor input as the top-level body. This caused every actor to
receive empty/default input and return nothing.

Add `body_path: "."` support to the gateway so a param's parsed value
can become the entire request body. Apply it to the Apify integration
definition. Add e2e smoke test covering URL templating, auth, body
structure, and array response handling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Two bugs fixed:

1. Actor input envelope: The gateway wrapped the `input` param as
   `{"input": {...}}` but Apify expects actor input as the top-level
   request body. Added `body_path: "."` support so a JSON param's
   parsed value becomes the entire body.

2. Actor ID URL format: Apify uses `~` as the namespace separator in
   API URLs (e.g. `apidojo~tweet-scraper`), not `/`. The `/` format
   created extra path segments causing 404s. Updated all 6 skill docs
   to use the correct tilde format.

Verified against live Apify API — returns tweet data correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@louismorgner louismorgner merged commit 49e5bb9 into main Mar 31, 2026
1 check 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