Skip to content

test(e2e): use plain ApifyClient for platform result reads#3776

Merged
B4nan merged 1 commit into
masterfrom
claude/crazy-hellman-e9cf8b
Jun 30, 2026
Merged

test(e2e): use plain ApifyClient for platform result reads#3776
B4nan merged 1 commit into
masterfrom
claude/crazy-hellman-e9cf8b

Conversation

@B4nan

@B4nan B4nan commented Jun 23, 2026

Copy link
Copy Markdown
Member

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 apify SDK change (3.7.2): Actor.newClient() now returns a charging-aware client whose .dataset() getter unconditionally calls Actor.getChargingManager().getPricingInfo(), which throws when the Actor was never initialized. The PLATFORM harness runs the Actor on the platform and never calls Actor.init() in the local process, so client.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 by apify) for the read-only result-gathering path, bypassing the charging patch. request-queue-with-concurrency keeps using Actor.newClient() since it never touches a dataset.

@github-actions github-actions Bot added this to the 143rd sprint - Tooling team milestone Jun 23, 2026
@github-actions github-actions Bot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels Jun 23, 2026
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.
@B4nan
B4nan force-pushed the claude/crazy-hellman-e9cf8b branch from 2982b2b to de7ada8 Compare June 23, 2026 07:44
@B4nan B4nan added the adhoc Ad-hoc unplanned task added during the sprint. label Jun 23, 2026
@B4nan

B4nan commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

@B4nan
B4nan requested a review from barjin June 29, 2026 15:46

@barjin barjin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, although the original issue seems like a breaking change (docs explicitly say you don't need to call init() unless running on the platform).

Approving this, please create an issue in SDK at your own discretion. Thanks!

@B4nan

B4nan commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

Yeah, good point, I thought its fine since this only happens with the platform jobs, but the same code would fail locally, we just dont use it with the memory/local jobs. Will PR that right ahead.

@B4nan
B4nan merged commit 652b926 into master Jun 30, 2026
14 of 16 checks passed
@B4nan
B4nan deleted the claude/crazy-hellman-e9cf8b branch June 30, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants