Skip to content

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

fix(scrapeURL): only retain ArrayTransport in testing

Gergő Móricz628a98d59459
diff --git a/apps/api/src/scraper/scrapeURL/index.ts b/apps/api/src/scraper/scrapeURL/index.ts
index 27a8f579d..bf155c3c7 100644
--- a/apps/api/src/scraper/scrapeURL/index.ts
+++ b/apps/api/src/scraper/scrapeURL/index.ts
@@ -97,7 +97,9 @@ function buildMetaObject(id: string, url: string, options: ScrapeOptions, intern
const _logger = logger.child({ module: "ScrapeURL", scrapeId: id });
const logs: any[] = [];
- _logger.add(new ArrayTransport({ array: logs, scrapeId: id }));
+ if (process.env.ENV !== "test") {
+ _logger.add(new ArrayTransport({ array: logs, scrapeId: id }));
+ }
return {
id, url, options, internalOptions,
diff --git a/apps/api/src/scraper/scrapeURL/scrapeURL.test.ts b/apps/api/src/scraper/scrapeURL/scrapeURL.test.ts
index ba5d5f69a..042fe060c 100644
--- a/apps/api/src/scraper/scrapeURL/scrapeURL.test.ts
+++ b/apps/api/src/scraper/scrapeURL/scrapeURL.test.ts
@@ -1,5 +1,7 @@
import "dotenv/config";
+process.env.ENV = "test";
+
import { scrapeURL } from ".";
import { scrapeOptions } from "../../controllers/v1/types";
import { Engine } from "./engines";