Skip to content

Commit 993ae5d

Browse files
committed
Edit migration guide
1 parent 3a0c308 commit 993ae5d

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

sources/platform/actors/development/permissions/migration_guide.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,23 @@ Recommended minimum SDK versions:
1616
- JavaScript SDK: [[email protected]](https://github.com/apify/apify-sdk-js/releases/tag/apify%403.4.4)
1717
- Python SDK: [v3.0.0](https://github.com/apify/apify-sdk-python/releases/tag/v3.0.0)
1818

19-
Before you start it's helpful to understand [what access restrictions limited permission impose](index.md#how-actor-permissions-work).
19+
Before you start it's helpful to understand [what access restrictions limited permissions impose](index.md#how-actor-permissions-work).
2020

21-
## How to test my Actor with limited permissions before migrating
21+
## How to test your Actor with limited permissions before migrating
2222

2323
You can override permission level for a single run using run options under Actor Source tab in Console:
2424

25-
![Force Actor permissions for a single runs.](./images/actor_run_permission_override.png)
25+
![Forcing Actor permissions for a single run.](./images/actor_run_permission_override.png)
2626

27-
Force Actor permissions for a single runs.
28-
29-
You can do the same using Apify Client as well:
27+
You can do the same using the Apify Client as well:
3028

3129
```tsx
3230
await apifyClient.actor(actorId).call(input, {
3331
forcePermissionLevel: ACTOR_PERMISSION_LEVEL.LIMITED_PERMISSIONS,
3432
});
3533
```
3634

37-
Or using just API:
35+
Or just using the API:
3836

3937
```tsx
4038
POST https://api.apify.com/v2/acts/<actor_id>/runs?**forcePermissionLevel=LIMITED_PERMISSIONS**
@@ -43,21 +41,28 @@ Or using just API:
4341

4442
## Common migration paths
4543

46-
We expect that most public Actors can be migrated to limited permissions with minor, if any, adjustments.
44+
We expect that most public Actors can be migrated to limited permissions with minor, if any, adjustments. The general prerequisite is to **update the Actor to use the latest [Apify SDK](https://docs.apify.com/sdk)**. To assess what, if anything, needs to change in your Actor, review the following:
45+
46+
- How your Actor uses storages: if it only writes to default storages, no changes needed.
47+
- Whether it calls other Actors: targets must also use limited permissions.
48+
- Whether it accesses user-provided storages: declare `resourceType` and `resourcePermissions` in `input_schema.json`.
49+
- Whether it uses named storages: rename/recreate and migrate data to retain access under limited permissions.
50+
- Whether it needs to know if the user is paying: use `APIFY_USER_IS_PAYING` or the SDK.
51+
- Whether it needs the user's proxy password: use `APIFY_PROXY_PASSWORD` or the SDK.
4752

48-
The general prerequisite is to **update the Actor to use the latest [Apify SDK](https://docs.apify.com/sdk)**. Below you can read a guide that covers various, more advanced cases.
53+
Once you have updated and [tested](#how-to-test-your-actor-with-limited-permissions-before-migrating) your Actor, you can change the permissions in the Actor settings. The setting will take immediate effect.
4954

50-
Once you have updated and [tested](#how-to-test-my-actor-with-limited-permissions-before-migrating) your Actor, you can change the permissions in the Actor setting. The setting will take immediate effect.
55+
Below you can read a guide covering common migration paths for more advanced cases in greater detail.
5156

5257
### The Actor only pushes data to default storages
5358

5459
This is the most common and simplest use case. If your Actor only reads its input and writes results to its default dataset, key-value store, or request queue, **no changes are needed**. Limited permissions fully support this behavior out of the box.
5560

56-
## The Actor calls other Actors
61+
### The Actor calls other Actors
5762

5863
An Actor with limited permissions can only call other Actors that also have limited permissions. If your Actor calls another one, you will need to ensure the target Actor has been migrated first.
5964

60-
## The Actor accesses storages provided by the user
65+
### The Actor accesses storages provided by the user
6166

6267
If your Actor is designed to read from or write to a storage that the user provides via an input field, you must explicitly declare what access you need in Actor’s schema.
6368

@@ -87,15 +92,15 @@ To support limited permissions, change it to this:
8792
}
8893
```
8994

90-
Now when the platform runs your Actor, it’ll automatically add the user provided storage the Actor’s scope so that it can access it.
95+
Now when the platform runs your Actor, it’ll automatically add the user provided storage to the Actor’s scope so that it can access it.
9196

9297
:::info Backward compatibility
9398

9499
The user can provide the resource both via its name and its ID. If you have existing users with existing inputs that specify the resource via its name, this change to the input schema won’t break it.
95100

96101
:::
97102

98-
## The Actor accesses named storages
103+
### The Actor accesses named storages
99104

100105
Actors sometimes use named storages for caching or persisting state across runs. With limited permissions, an Actor can create a named storage on its first run and will automatically retain access to it in all subsequent runs by the same user.
101106

@@ -131,16 +136,16 @@ The goal here is to create the new storage **only once the Actor runs with limit
131136

132137
:::
133138

134-
**If the existing contents of the named storage is critical for your Actor to keep functioning for the existing users** (as in, you can’t afford removing the storage), reach out to us. We can discuss the available options.
139+
If the existing contents of the named storage are critical for your Actor to keep functioning for the existing users and it is impossible, costly or highly impractical to migrate, contact support or reach out to us on the community forum. We can discuss the available options.
135140

136-
## The Actor needs to know whether the user is paying
141+
### The Actor needs to know whether the user is paying
137142

138143
Some Actors have different logic for free and paying users. Previously you could retrieve this information by calling the `/users/me` API endpoint. However, Actors running under limited permissions don't have access to that endpoint, to get this information, your Actor should read the `APIFY_USER_IS_PAYING` environment variable, or directly use the SDK to obtain the value:
139144

140145
```ts
141146
const { userIsPaying } = Actor.getEnv();
142147
```
143148

144-
## The Actor uses proxy
149+
### The Actor uses Proxy
145150

146-
Similarly, if your Actor needs the user's proxy password, it should get it from the `APIFY_PROXY_PASSWORD` environment variable instead of calling the `/users/me` endpoint, or preferably just rely on the SDK to take care of the documentation.
151+
Similarly, if your Actor uses [Proxy](../../../proxy/index.md) and needs to retrieve the user's proxy password, it should get it from the `APIFY_PROXY_PASSWORD` environment variable instead of calling the `/users/me` endpoint or, preferably, rely directly on the SDK to handle proxy configuration automatically.

0 commit comments

Comments
 (0)