fix(firecrawl) fix firecrawl scrape credit usage calculation#3583
fix(firecrawl) fix firecrawl scrape credit usage calculation#3583TheodoreSpeaks merged 3 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Written by Cursor Bugbot for commit e29e2b9. This will update automatically on new commits. Configure here. |
Greptile SummaryThis PR fixes the Firecrawl scrape tool's credit usage calculation by reading Key changes:
Issues found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Tool as scrapeTool
participant API as Firecrawl API (v2/scrape)
participant Transform as transformResponse
participant Cost as getCost (pricing)
Tool->>API: POST /v2/scrape
API-->>Transform: { data: { markdown, html, metadata: { ..., creditsUsed } }, creditsUsed: undefined }
Transform-->>Tool: output = { markdown, html, metadata: data.data.metadata, creditsUsed: data.creditsUsed (undefined) }
Note over Transform: ⚠️ data.creditsUsed is now always undefined<br/>(API moved it into data.metadata)
Tool->>Cost: getCost(_params, output)
Cost->>Cost: (output.metadata as {creditsUsed?}).creditsUsed ✅
Cost-->>Tool: { cost: creditsUsed * 0.001, metadata: { creditsUsed } }
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Incomplete fix: transformResponse still reads stale root-level creditsUsed
- Updated scrape transformResponse to read creditsUsed from metadata so the output no longer uses the stale root-level field.
Or push these changes by commenting:
@cursor push 01f02f1169
Preview (01f02f1169)
diff --git a/apps/sim/tools/firecrawl/scrape.ts b/apps/sim/tools/firecrawl/scrape.ts
--- a/apps/sim/tools/firecrawl/scrape.ts
+++ b/apps/sim/tools/firecrawl/scrape.ts
@@ -111,7 +111,7 @@
markdown: data.data.markdown,
html: data.data.html,
metadata: data.data.metadata,
- creditsUsed: data.creditsUsed,
+ creditsUsed: data.data.metadata?.creditsUsed,
},
}
},This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.


Summary
Firecrawl creditsUsed is now stored in metadata, not as a root level field. Adjusted block to accomodate.
Type of Change
Testing
Validated that scrape operation now operates without failing on missing creditsUsed. Tested all other operations to ensure this change wasn't made elsewhere.
Checklist
Screenshots/Videos