Skip to content

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

Fix Supabase client configuration errors when USE_DB_AUTHENTICATION is false (#1534)

devin-ai-integration[bot]ab30c8e4acf6
diff --git a/apps/api/src/services/queue-worker.ts b/apps/api/src/services/queue-worker.ts
index 553b944fd..622d5cfb7 100644
--- a/apps/api/src/services/queue-worker.ts
+++ b/apps/api/src/services/queue-worker.ts
@@ -147,19 +147,23 @@ async function finishCrawlIfNeeded(job: Job & { id: string }, sc: StoredCrawl) {
"crawl:" + job.data.crawl_id + ":visited_unique",
),
);
-
+
logger.info("Visited URLs", {
visitedUrls: visitedUrls.size,
});
- const lastUrls: string[] = (
- (
- await supabase_service.rpc("diff_get_last_crawl_urls", {
- i_team_id: job.data.team_id,
- i_url: sc.originUrl!,
- })
- ).data ?? []
- ).map((x) => x.url);
+ let lastUrls: string[] = [];
+ const useDbAuthentication = process.env.USE_DB_AUTHENTICATION === "true";
+ if (useDbAuthentication) {
+ lastUrls = (
+ (
+ await supabase_service.rpc("diff_get_last_crawl_urls", {
+ i_team_id: job.data.team_id,
+ i_url: sc.originUrl!,
+ })
+ ).data ?? []
+ ).map((x) => x.url);
+ }
const lastUrlsSet = new Set(lastUrls);
@@ -257,7 +261,8 @@ async function finishCrawlIfNeeded(job: Job & { id: string }, sc: StoredCrawl) {
if (
visitedUrls.length > 0 &&
job.data.crawlerOptions !== null &&
- originUrl
+ originUrl &&
+ process.env.USE_DB_AUTHENTICATION === "true"
) {
// Queue the indexing job instead of doing it directly
await getIndexQueue().add(