Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

reverting delete, fixed express bug on checkCredits

rafaelsideguideb66553867e8a
diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts
index cb9cacde0..9d46d0054 100644
--- a/apps/api/src/controllers/auth.ts
+++ b/apps/api/src/controllers/auth.ts
@@ -152,7 +152,7 @@ export async function supaAuthenticateUser(
);
}
} catch (error) {
- Logger.error(`Error with auth function: ${error.message}`);
+ Logger.error(`Error with auth function: ${error}`);
// const {
// success,
// teamId: tId,
diff --git a/apps/api/src/controllers/scrape.ts b/apps/api/src/controllers/scrape.ts
index 3d568790c..273b4c56b 100644
--- a/apps/api/src/controllers/scrape.ts
+++ b/apps/api/src/controllers/scrape.ts
@@ -108,22 +108,18 @@ export async function scrapeController(req: Request, res: Response) {
timeout = req.body.timeout ?? 90000;
}
- const checkCredits = async () => {
- try {
- const { success: creditsCheckSuccess, message: creditsCheckMessage } = await checkTeamCredits(team_id, 1);
- if (!creditsCheckSuccess) {
- earlyReturn = true;
- return res.status(402).json({ error: "Insufficient credits" });
- }
- } catch (error) {
- Logger.error(error);
+ // checkCredits
+ try {
+ const { success: creditsCheckSuccess, message: creditsCheckMessage } = await checkTeamCredits(team_id, 1);
+ if (!creditsCheckSuccess) {
earlyReturn = true;
- return res.status(500).json({ error: "Error checking team credits. Please contact [email protected] for help." });
+ return res.status(402).json({ error: "Insufficient credits" });
}
- };
-
-
- await checkCredits();
+ } catch (error) {
+ Logger.error(error);
+ earlyReturn = true;
+ return res.status(500).json({ error: "Error checking team credits. Please contact [email protected] for help." });
+ }
const jobId = uuidv4();
diff --git a/apps/api/src/scraper/WebScraper/scrapers/fireEngine.ts b/apps/api/src/scraper/WebScraper/scrapers/fireEngine.ts
index 408cad296..6f97d96fe 100644
--- a/apps/api/src/scraper/WebScraper/scrapers/fireEngine.ts
+++ b/apps/api/src/scraper/WebScraper/scrapers/fireEngine.ts
@@ -123,9 +123,9 @@ export async function scrapWithFireEngine({
if (checkStatusResponse.data.processing) {
try {
Logger.debug(`⛏️ Fire-Engine (${engine}): deleting request - jobId: ${_response.data.jobId}`);
- // axiosInstance.delete(
- // process.env.FIRE_ENGINE_BETA_URL + `/scrape/${_response.data.jobId}`,
- // );
+ axiosInstance.delete(
+ process.env.FIRE_ENGINE_BETA_URL + `/scrape/${_response.data.jobId}`,
+ );
} catch (error) {
Logger.debug(`⛏️ Fire-Engine (${engine}): Failed to delete request - jobId: ${_response.data.jobId} | error: ${error}`);
logParams.error_message = "Failed to delete request";