test(e2e): use plain ApifyClient for platform result reads#3776
Open
B4nan wants to merge 1 commit into
Open
Conversation
The apify SDK (3.7.2) changed `Actor.newClient()` to return a charging-aware client whose `.dataset()` getter calls `Actor.getChargingManager().getPricingInfo()`, which throws "ChargingManager is not initialized" when the Actor was never initialized. The PLATFORM e2e harness runs the Actor on the platform and never calls `Actor.init()` locally, so reading dataset results via `client.dataset(...).listItems()` started failing for every test. Use a plain `ApifyClient` (re-exported by apify) for the read-only result-gathering path instead, bypassing the charging patch.
2982b2b to
de7ada8
Compare
Member
Author
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.
What & why
The scheduled PLATFORM E2E run started failing on every dataset-reading test with
Error: ChargingManager is not initialized(example run).Root cause is an
apifySDK change (3.7.2):Actor.newClient()now returns a charging-aware client whose.dataset()getter unconditionally callsActor.getChargingManager().getPricingInfo(), which throws when the Actor was never initialized. The PLATFORM harness runs the Actor on the platform and never callsActor.init()in the local process, soclient.dataset(...).listItems()blew up.The one PLATFORM test that doesn't read a dataset (
request-queue-with-concurrency) kept passing, confirming the cause.Fix
Use a plain
ApifyClient(re-exported byapify) for the read-only result-gathering path, bypassing the charging patch.request-queue-with-concurrencykeeps usingActor.newClient()since it never touches a dataset.