Repository navigation
feat: add server_request for calling Server Actors, with per-request compression in HTTP clients - #1153
Draft
vdusek wants to merge 11 commits into
Draft
feat: add server_request for calling Server Actors, with per-request compression in HTTP clients#1153vdusek wants to merge 11 commits into
server_request for calling Server Actors, with per-request compression in HTTP clients#1153vdusek wants to merge 11 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1153 +/- ##
==========================================
+ Coverage 95.53% 95.56% +0.03%
==========================================
Files 61 61
Lines 5976 5997 +21
==========================================
+ Hits 5709 5731 +22
+ Misses 267 266 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vdusek
added a commit
to apify/apify-docs
that referenced
this pull request
Oct 20, 2026
While working on better support for calling Standby Actors from the API client (apify/apify-client-python#1153), I couldn't find an explanation of how the authentication headers are handled (Maybe I just missed it?). I have two questions: 1. Does the Apify token reach the Actor's code? (It shouldn't.). 2. If an Actor needs its own authentication header, what's the best practice for sending it? Is it `X-Apify-Authorization`? I drafted a change; see the diff and suggest better/correct/more precise explanation. Thank you. (tagging @mvolfik, as I know a lot of the work there was done by you)
standby_request for calling Standby Actorsstandby_request for calling Standby Actors, with per-request compression in HTTP clients
standby_request for calling Standby Actors, with per-request compression in HTTP clientsserver_request for calling Server Actors, with per-request compression in HTTP clients
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
ActorClient.server_request()(and the async twin) for sending HTTP requests to a Server Actor, so users don't have to look up the server URL and attach the token by hand.The design follows the CLI RFC (apify/apify-cli#1299):
standbyUrlreturned by the API, so the token can't be sent to another host. Both built-in HTTP clients dropAuthorizationon a cross-host redirect.Authorizationheader. The platform removes it before forwarding, so it never reaches the Actor's code. An Actor that readsAuthorizationfor its own auth gets the Apify token inX-Apify-Authorizationinstead, as described in the platform docs.compressionargument opts in, with an algorithm name or anHttpCompressor.long, since the first request to an idle Actor waits for a server run to start.ApifyApiError, and 5xx/429 are retried like API calls. The docs say so, because a non-idempotent endpoint may get the request twice.To support the opt-in,
HttpClient.callandHttpClientAsync.calltake a per-requestcompressionargument:Trueuses the client's compressor, anHttpCompressoris used for that request only, andFalsesends the body uncompressed. A custom HTTP client that replacescallitself (not justsend_request) needs to accept the new argument to work withserver_request.Also fixes the async docstring sync script, which turned
ApifyClientErrorinto the nonexistentApifyClientAsyncError.Naming follows the Server Actors rename. The API still calls the feature Standby (
standbyUrl,actorStandby), so the model field staysstandby_url. Includes a concepts page covering authentication, compression, timeouts, and retries.Closes: #973
✍️ Drafted by Claude Code