Skip to content

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

fix(search): handle scrape timeouts on search

Gergő Móricz508568f94381
diff --git a/apps/api/src/controllers/search.ts b/apps/api/src/controllers/search.ts
index 21a8e390d..63820aba6 100644
--- a/apps/api/src/controllers/search.ts
+++ b/apps/api/src/controllers/search.ts
@@ -186,6 +186,10 @@ export async function searchController(req: Request, res: Response) {
});
return res.status(result.returnCode).json(result);
} catch (error) {
+ if (error instanceof Error && error.message.startsWith("Job wait")) {
+ return res.status(408).json({ error: "Request timed out" });
+ }
+
Sentry.captureException(error);
Logger.error(error);
return res.status(500).json({ error: error.message });