Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: merge mock success data #1013

Merged
merged 1 commit into from
Dec 27, 2024
Merged

fix: merge mock success data #1013

merged 1 commit into from
Dec 27, 2024

Conversation

yujunhui
Copy link
Contributor

I am using API /v0/crawl with the limit=10 setting, but this setting does not take effect.
After some investigation, I found that in code

const limitCheck = req.body?.crawlerOptions?.limit ?? 1;
const {
success: creditsCheckSuccess,
message: creditsCheckMessage,
remainingCredits,
} = await checkTeamCredits(chunk, team_id, limitCheck);
if (!creditsCheckSuccess) {
return res.status(402).json({
error:
"Insufficient credits. You may be requesting with a higher limit than the amount of credits you have left. If not, upgrade your plan at https://firecrawl.dev/pricing or contact us at help@firecrawl.com",
});
}
// TODO: need to do this to v1
crawlerOptions.limit = Math.min(remainingCredits, crawlerOptions.limit);

remainingCredits returns undefined, which causes Math.min(remainingCredits, crawlerOptions.limit) to return a NaN, resulting in the limit parameter not being effective.

@nickscamara
Copy link
Member

Good catch!!

@nickscamara nickscamara merged commit 65cf4cd into mendableai:main Dec 27, 2024
Copy link
Member

@mogery mogery left a comment

Choose a reason for hiding this comment

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

Great catch, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants