agentsclimarketplace

Apify upgrade migration

Skill jeremylongshore/claude-code-plugins-plus-skills/plugins/saas-packs/apify-pack/skills/apify-upgrade-migration

Upgrade Apify SDK, apify-client, and Crawlee versions safely. Use when migrating between SDK versions, handling breaking changes, or updating from Apify SDK v2 to v3 (Crawlee split). Trigger with "upgrade apify", "apify migration", "apify breaking changes", "update apify SDK", "crawlee upgrade", "apify v2 to v3".From its SKILL.md

Install
npx -y skills add jeremylongshore/claude-code-plugins-plus-skills --skill apify-upgrade-migration

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

5.9 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it

Apify Upgrade & Migration

Overview

Guide for upgrading apify, apify-client, and crawlee packages. The biggest migration in Apify's history was SDK v2 to v3, which split crawling functionality into the crawlee package. This skill covers that migration plus general upgrade procedures. Read and edit source files with Grep/Read/Edit to apply the rename-heavy changes, then verify with the packaged script.

Prerequisites

Before starting, confirm the working tree is in a recoverable state:

  • A dedicated git branch for the upgrade, so a bad bump can be reverted cleanly.
  • A runnable test suite (npm test) plus a build step (npm run build) to catch TypeScript interface changes.
  • The current installed versions recorded (npm list apify apify-client crawlee) so rollback targets are known.
  • APIFY_TOKEN in the environment if the verification script's API-connection check will run.

Instructions

Step 1: Check Current Versions

# Check installed versions
npm list apify apify-client crawlee 2>/dev/null

# Check latest available versions
npm view apify version
npm view apify-client version
npm view crawlee version

# Check for outdated packages
npm outdated apify apify-client crawlee

Step 2: Create Upgrade Branch

git checkout -b upgrade/apify-packages

Step 3: Upgrade Packages

# Upgrade to latest
npm install apify@latest crawlee@latest apify-client@latest

# Or upgrade to specific version
npm install [email protected] [email protected]

# Check for peer dependency issues
npm ls 2>&1 | grep "ERESOLVE\|peer dep"

Step 4: Apply Code Changes

If crossing the v2→v3 boundary, use Grep to find every Apify. reference and Edit each call site. The full before/after set — imports, Actor.main, crawler option renames (handlePageFunctionrequestHandler), proxy config, request queues, and the new router pattern — is in the v2-to-v3 migration guide. Minimal shape:

// v2
import Apify from 'apify';
const { CheerioCrawler } = Apify;
// v3
import { Actor } from 'apify';
import { CheerioCrawler } from 'crawlee';

Step 5: Verify and Test

npm test
npm run build  # Catch TypeScript errors

Then run the packaged verification script from verify-and-rollback.md, which checks imports resolve, the client connects, and a crawler instantiates.

Output

A successful upgrade produces:

  • Updated package.json / package-lock.json with the new apify, crawlee, and apify-client versions on the upgrade/apify-packages branch.
  • Migrated source files with all Apify.* call sites converted to Actor.* / crawlee imports (only when crossing v2→v3).
  • A passing verification run, e.g.:
=== Upgrade Verification ===
  [PASS] Actor import
  [PASS] CheerioCrawler import
  [PASS] ApifyClient import
  [PASS] API connection
  [PASS] Crawler instantiation

All checks passed.

If any check fails, follow the rollback procedure to restore the previous versions before investigating.

Error Handling

ErrorCauseSolution
handlePageFunction is not validUsing v2 option names in v3Rename to requestHandler
Apify.main is not a functionv2 default export removedImport { Actor } from apify
Cannot find module 'crawlee'Crawlee not installednpm install crawlee
Type errors after upgradeChanged interfacesCheck release notes for type changes
ERESOLVE peer conflict on installMismatched apify/crawlee majorsPin both to matching majors, e.g. apify@3 crawlee@3

Examples

Example 1 — Straight version bump (no major boundary). Update within v3 and confirm nothing broke:

git checkout -b upgrade/apify-packages
npm install apify@latest crawlee@latest apify-client@latest
npm test && npm run build

Example 2 — v2 → v3 crawler migration. Rename the removed option names in a crawler config:

// BEFORE (v2)
const crawler = new Apify.CheerioCrawler({
  handlePageFunction: async ({ request, $ }) => { /* ... */ },
});
// AFTER (v3 / Crawlee)
const crawler = new CheerioCrawler({
  requestHandler: async ({ request, $ }) => { /* ... */ },
});

Example 3 — apify-client constructor change. Drop the removed userId:

// v1.x
const client = new ApifyClient({ userId: 'xxx', token: 'yyy' });
// v2+
const client = new ApifyClient({ token: 'yyy' });

Deeper walkthroughs — the complete v2→v3 rename set and the full verification script — live in references/.

Resources

Next Steps

For CI integration during upgrades, see apify-ci-integration.

What ships with it: 2 files

5.6 KB alongside SKILL.md

Keep looking

Skills are one crate of 326,144. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.