Skip to content

refactor: adapt SDK Configuration for crawlee Configuration redesign#583

Open
B4nan wants to merge 2 commits intov4from
refactor/configuration-class-redesign
Open

refactor: adapt SDK Configuration for crawlee Configuration redesign#583
B4nan wants to merge 2 commits intov4from
refactor/configuration-class-redesign

Conversation

@B4nan
Copy link
Copy Markdown
Member

@B4nan B4nan commented Mar 25, 2026

Summary

  • Adapts the SDK's Configuration class extension to work with the new field-based Configuration from crawlee (Simplify Configuration crawlee#3080)
  • Replaces .get('key') / .set('key', value) calls with direct property access (.key) across all SDK files
  • Replaces config.useStorageClient() / config.useEventManager() with serviceLocator.setStorageClient() / serviceLocator.setEventManager()
  • Adds zod as a direct dependency (SDK defines its own config fields using zod schemas)
  • Fixes tests that relied on mutable configuration (env var mutation after init)

Dependencies

  • Depends on Simplify Configuration crawlee#3080 being merged and released first
  • There are also unrelated v4 API changes in crawlee core (EventManager constructor, ProxyConfiguration signatures, etc.) that will need separate fixes before this fully type-checks

🤖 Generated with Claude Code

B4nan and others added 2 commits March 13, 2026 18:36
Refactor the SDK Configuration class to match the new crawlee core
Configuration redesign:

- Subclass core Configuration using `protected static override fields`
- Direct property access (`config.token`) instead of `config.get('token')`
- Immutable: values set via constructor, no `set()` method
- Priority: constructor options > env vars > schema defaults
- isAtHome conditional defaults moved into field definitions
- Use serviceLocator instead of config.useStorageClient/getEventManager
- Import z, coerceNumber, coerceBoolean from @crawlee/core (no direct zod dep)
- Update all .get()/.set() call sites in actor.ts, charging.ts, etc.
- Update tests to use property access

Depends on crawlee PR: apify/crawlee#3474

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Import `z` from `zod` directly (no longer re-exported from crawlee core)
- Define `coerceNumber` locally (no longer exported from crawlee core)
- Add constructor override to accept `ApifyConfigurationInput`
- Import `ConfigurationOptions` from SDK configuration instead of core
- Fix test that mutated env vars after init (immutable config)

Depends on: apify/crawlee#3080

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants