Repository navigation
feat: add Server Actor support (formerly Actor Standby) - #1153
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1153 +/- ##
==========================================
+ Coverage 95.67% 95.72% +0.05%
==========================================
Files 61 62 +1
Lines 6473 6651 +178
==========================================
+ Hits 6193 6367 +174
- Misses 280 284 +4
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
server_request for calling Server Actors, with per-request compression in HTTP clientsserver_request for calling Server Actors endpoints
server_request for calling Server Actors endpointsserver_request for calling Server Actor endpoints
vdusek
marked this pull request as ready for review
October 26, 2026 07:40
vdusek
commented
Oct 26, 2026
This was referenced Oct 30, 2026
Closed
janbuchar
approved these changes
Nov 2, 2026
janbuchar
left a comment
Contributor
There was a problem hiding this comment.
LGTM, even though apify/apify-client-js#1179 (comment) applies here as well
…-Apify-Authorization
vdusek
added a commit
to apify/apify-client-js
that referenced
this pull request
Nov 4, 2026
Adds `ActorClient.server()`, which returns an `ActorServerClient` for
Server Actors (formerly Actor Standby):
```ts
const actorServerClient = client.actor('username/actor-name').server();
const response = await actorServerClient.request('/search', { params: { q: 'apify' } });
const url = await actorServerClient.getUrl();
const spec = await actorServerClient.getOpenApiSpec();
```
- `request()` sends a request to the Actor's server. The host always
comes from the Actor's `standbyUrl`. The token goes in the
`X-Apify-Authorization` header, which the platform strips, so headers
the caller passes, `Authorization` included, reach the Actor as they
are. It doesn't follow redirects and returns a redirect response as it
is, so the token can't reach a host the Actor's code picked.
- `request()` returns the server's response whatever its status. Only
429 and 503 are retried, since other statuses may come from the Actor's
code. Network errors and timeouts aren't retried, since the Actor may
have already handled the request. It throws only when it gets no
response: the Actor doesn't exist or isn't a Server Actor, or the
request fails or times out.
- `request()` sends bodies uncompressed unless `compression` is set,
returns the body parsed, as a buffer, or as a stream depending on
`responseType`, and defaults to the `long` timeout to cover a cold
start.
- `getUrl()` returns the server URL. It's fetched once per
`ActorClient`, by `getUrl()` or `getOpenApiSpec()`.
- `getOpenApiSpec()` returns the web server schema from the build that
serves the server (`actorStandby.build`, or `latest`), or `undefined` if
there's none.
`ActorClient.standby()` is a deprecated alias of `server()` and will be
removed in v4.
Other changes:
- `ApifyRequestConfig` takes new per-request options: `compression`,
`authorizationHeader`, `throwOnErrorStatus`, `retryStatusCodes`,
`retryTransportErrors`, and `followRedirects`. A custom HTTP client that
overrides `call()` should honor them, and one that overrides
`sendRequest()` must honor the new `HttpRequest.followRedirects` field,
or it would follow a redirect with the token.
- A Server Actors concepts page, unit tests, and an integration test
against a temporary echo Server Actor.
Port of apify/apify-client-python#1153.
Closes: #1159
*✍️ Drafted by Claude Code*
vdusek
added a commit
that referenced
this pull request
Nov 5, 2026
…1202) Renames the `actor_standby_*` arguments of `ActorClient.update`, `ActorCollectionClient.create`, `TaskClient.update`, and `TaskCollectionClient.create` (sync and async) to the Server Actor naming used by `ActorClient.server()`: | Deprecated | New | | --- | --- | | `actor_standby_is_enabled` | `server_is_enabled` | | `actor_standby_desired_requests_per_actor_run` | `server_desired_requests_per_actor_run` | | `actor_standby_max_requests_per_actor_run` | `server_max_requests_per_actor_run` | | `actor_standby_idle_timeout` | `server_idle_timeout` | | `actor_standby_build` | `server_build` | | `actor_standby_memory_mbytes` | `server_memory_mbytes` | | `actor_standby_disable_standby_fields_override` | `server_disable_fields_override` | | `actor_standby_should_pass_actor_input` | `server_should_pass_actor_input` | The task methods take the five arguments they had before. The old names stay as deprecated aliases until v4, the same way as `build_tag` in `validate_input()`. Each one set emits a `DeprecationWarning` at the caller, and passing an alias together with its new name raises a `ValueError`. All eight methods share one helper, `build_actor_standby`, which maps the aliases and builds the `actorStandby` field. `actor_standby_tenancy` from #1169 isn't on master yet, so it isn't covered here. #1169 can add it as `server_tenancy` directly, without an alias. It should ship in the same release as #1153. Closes: #1195 *✍️ Drafted by Claude Code*
janbuchar
pushed a commit
to apify/apify-client-js
that referenced
this pull request
Nov 10, 2026
…1179) Adds `ActorClient.server()`, which returns an `ActorServerClient` for Server Actors (formerly Actor Standby): ```ts const actorServerClient = client.actor('username/actor-name').server(); const response = await actorServerClient.request('/search', { params: { q: 'apify' } }); const url = await actorServerClient.getUrl(); const spec = await actorServerClient.getOpenApiSpec(); ``` - `request()` sends a request to the Actor's server. The host always comes from the Actor's `standbyUrl`. The token goes in the `X-Apify-Authorization` header, which the platform strips, so headers the caller passes, `Authorization` included, reach the Actor as they are. It doesn't follow redirects and returns a redirect response as it is, so the token can't reach a host the Actor's code picked. - `request()` returns the server's response whatever its status. Only 429 and 503 are retried, since other statuses may come from the Actor's code. Network errors and timeouts aren't retried, since the Actor may have already handled the request. It throws only when it gets no response: the Actor doesn't exist or isn't a Server Actor, or the request fails or times out. - `request()` sends bodies uncompressed unless `compression` is set, returns the body parsed, as a buffer, or as a stream depending on `responseType`, and defaults to the `long` timeout to cover a cold start. - `getUrl()` returns the server URL. It's fetched once per `ActorClient`, by `getUrl()` or `getOpenApiSpec()`. - `getOpenApiSpec()` returns the web server schema from the build that serves the server (`actorStandby.build`, or `latest`), or `undefined` if there's none. `ActorClient.standby()` is a deprecated alias of `server()` and will be removed in v4. Other changes: - `ApifyRequestConfig` takes new per-request options: `compression`, `authorizationHeader`, `throwOnErrorStatus`, `retryStatusCodes`, `retryTransportErrors`, and `followRedirects`. A custom HTTP client that overrides `call()` should honor them, and one that overrides `sendRequest()` must honor the new `HttpRequest.followRedirects` field, or it would follow a redirect with the token. - A Server Actors concepts page, unit tests, and an integration test against a temporary echo Server Actor. Port of apify/apify-client-python#1153. Closes: #1159 *✍️ Drafted by Claude Code* 2.x backport: Built on the 2.x axios `HttpClient`, which gains opt-in `throwOnErrorStatus`, `retryStatusCodes`, `retryTransportErrors` and `doNotCompress` request options. There is no `compression` option, since it depends on the pluggable compressors from #1065. The request body is always sent uncompressed. The `AbortSignal` support and the timeout tiers are not ported, and errors are plain `Error`s.
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()andActorClientAsync.server(), which return anActorServerClient/ActorServerClientAsyncfor Server Actors (formerly Actor Standby):request()sends a request to the Actor's server. The host always comes from the Actor'sstandbyUrl. The token goes in theX-Apify-Authorizationheader, which the platform strips, so headers the caller passes,Authorizationincluded, reach the Actor as they are. It doesn't follow redirects and returns a redirect response as it is, so the token can't reach a host the Actor's code picked.request()returns the server's response whatever its status. Only 429 and 503 are retried, since other statuses may come from the Actor's code. Network errors and timeouts aren't retried, since the Actor may have already handled the request. It raises only when it gets no response: the Actor doesn't exist or isn't a Server Actor, or the request fails or times out.request()sends bodies uncompressed unlesscompressionis set, returns the body unread withstream=True, and defaults to thelongtimeout to cover a cold start.get_url()returns the server URL. It's fetched once perActorClient, byget_url()orget_openapi_spec().get_openapi_spec()returns the web server schema from the build that serves the server (actorStandby.build, orlatest), orNoneif there's none. The schema field comes from fix(openapi): add missing fields to the Actor definition schema apify-docs#3115.get_url()andget_openapi_spec()take atimeout.ActorClient.standby()is a deprecated alias ofserver()and will be removed in v4.Other changes:
HttpClient.callandHttpClientAsync.calltake new arguments:compression,authorization_header,raise_for_status,retry_status_codes,retry_transport_errors, andfollow_redirects. A custom HTTP client that overridescallmust accept and honor them, and one that implementssend_requestmust honorfollow_redirects.&to a URL that already has a query.ApifyClientErrorinto a nonexistentApifyClientAsyncError.Closes: #973
✍️ Drafted by Claude Code