Skip to content

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

fix(scrape): ensure extractionSchema is an object if llm-extraction is specified

Gergő Móricz0e8fd6ce7089
diff --git a/apps/api/src/controllers/scrape.ts b/apps/api/src/controllers/scrape.ts
index b2d1db34f..959cc546f 100644
--- a/apps/api/src/controllers/scrape.ts
+++ b/apps/api/src/controllers/scrape.ts
@@ -105,6 +105,10 @@ export async function scrapeController(req: Request, res: Response) {
let timeout = req.body.timeout ?? defaultTimeout;
if (extractorOptions.mode.includes("llm-extraction")) {
+ if (typeof extractorOptions.extractionSchema !== "object" || extractorOptions.extractionSchema === null) {
+ return res.status(400).json({ error: "extractorOptions.extractionSchema must be an object if llm-extraction mode is specified" });
+ }
+
pageOptions.onlyMainContent = true;
timeout = req.body.timeout ?? 90000;
}