Skip to content

fix(actors info): handle tiered pay-per-event pricing#1173

Open
l2ysho wants to merge 2 commits into
masterfrom
1171-apify-actors-info-actor-crashes-with-tofixed-error-on-paidmonetized-store-actors
Open

fix(actors info): handle tiered pay-per-event pricing#1173
l2ysho wants to merge 2 commits into
masterfrom
1171-apify-actors-info-actor-crashes-with-tofixed-error-on-paidmonetized-store-actors

Conversation

@l2ysho
Copy link
Copy Markdown
Contributor

@l2ysho l2ysho commented Jun 2, 2026

The pricing renderer assumed eventPriceUsd was always a number, but tiered
pay-per-event Actors (e.g. lukaskrivka/google-maps-with-contact-details) ship
eventTieredPricingUsd instead, so calling .toFixed(2) on undefined crashed
actors info with exit 1 for these Store Actors. --input / --readme / --json
were unaffected because they bypass the pricing renderer.

Replace the local PricingInfo interface with apify-client's ActorRunPricingInfo
discriminated union, augment ActorChargeEvent locally for the tiered field
the SDK doesn't expose yet, and render from \$X (tiered) for tiered events.
Add an e2e regression test against the actor from the bug report.

Fixes #1171

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

The pricing renderer assumed eventPriceUsd was always a number, but tiered
pay-per-event Actors (e.g. lukaskrivka/google-maps-with-contact-details) ship
eventTieredPricingUsd instead, so calling .toFixed(2) on undefined crashed
`actors info` with exit 1 for these Store Actors. --input / --readme / --json
were unaffected because they bypass the pricing renderer.

Replace the local PricingInfo interface with apify-client's ActorRunPricingInfo
discriminated union, augment ActorChargeEvent locally for the tiered field
the SDK doesn't expose yet, and render `from \$X (tiered)` for tiered events.
Add an e2e regression test against the actor from the bug report.

Fixes #1171

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@l2ysho l2ysho self-assigned this Jun 2, 2026
@l2ysho l2ysho requested a review from vladfrangu as a code owner June 2, 2026 07:55
@l2ysho l2ysho added the t-dx Issues owned by the DX team. label Jun 2, 2026
@github-actions github-actions Bot added this to the 142nd sprint - Tooling team milestone Jun 2, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Jun 2, 2026
Comment thread src/commands/actors/info.ts Outdated
const tiered = eventInfo.eventTieredPricingUsd;
let priceLabel: string;
if (typeof flat === 'number') {
priceLabel = `$${flat.toFixed(2)}`;
Copy link
Copy Markdown
Contributor

@patrikbraborec patrikbraborec Jun 2, 2026

Choose a reason for hiding this comment

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

toFixed(2) is still problematic for tiered pay-per-event prices because many of these event prices are below one cent. The crash is fixed, but this now renders real prices like 0.005 or 0.00079 as from $0.00 (tiered), which is misleading.

…0.00

Most tiered pay-per-event Actors charge sub-cent prices (e.g. $0.005,
$0.00079). toFixed(2) rounded these to "$0.00", so the renderer printed
"from $0.00 (tiered)" — making real costs look free. Same problem for
flat sub-cent eventPriceUsd, not just tiered.

Use 2 decimals when the price is >= $0.01, otherwise 2 significant
figures: $0.005 -> "$0.005", $0.00079 -> "$0.00079", $0.25 -> "$0.25".

Refs #1171

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@l2ysho l2ysho requested a review from patrikbraborec June 2, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-dx Issues owned by the DX team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

apify actors info <actor> crashes with toFixed error on paid/monetized Store Actors

3 participants