From 288d2a397d64da87f1ec08877895310edde46d2f Mon Sep 17 00:00:00 2001 From: Aric Lasry Date: Thu, 28 Sep 2023 13:05:43 +0200 Subject: [PATCH] Debug plan check on document upsert (#1851) --- .../[name]/documents/[documentId]/index.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/front/pages/api/v1/w/[wId]/data_sources/[name]/documents/[documentId]/index.ts b/front/pages/api/v1/w/[wId]/data_sources/[name]/documents/[documentId]/index.ts index 401134481243..32d125eb2cb7 100644 --- a/front/pages/api/v1/w/[wId]/data_sources/[name]/documents/[documentId]/index.ts +++ b/front/pages/api/v1/w/[wId]/data_sources/[name]/documents/[documentId]/index.ts @@ -16,6 +16,7 @@ import { Authenticator, getAPIKey } from "@app/lib/auth"; import { CoreAPI, CoreAPILightDocument } from "@app/lib/core_api"; import { ReturnedAPIErrorType } from "@app/lib/error"; import { validateUrl } from "@app/lib/utils"; +import logger from "@app/logger/logger"; import { apiError, withLogging } from "@app/logger/withlogging"; import { DataSourceType } from "@app/types/data_source"; import { DocumentType } from "@app/types/document"; @@ -226,6 +227,19 @@ async function handler( // the `getDataSourceDocuments` query involves a SELECT COUNT(*) in the DB that is not // optimized, so we avoid it for large workspaces if we know we're unlimited anyway if (owner.plan.limits.dataSources.documents.count != -1) { + logger.info( + { + requestWid: req.query.wId as string, + requestDataSourceName: req.query.name as string, + requestDocumentId: req.query.documentId as string, + planDocumentCount: owner.plan.limits.dataSources.documents.count, + planDocumentCountTypeOf: + typeof owner.plan.limits.dataSources.documents.count, + ownerPlan: JSON.stringify(owner.plan), + owner: owner.sId, + }, + "Checking documents count limit" + ); const documents = await CoreAPI.getDataSourceDocuments({ projectId: dataSource.dustAPIProjectId, dataSourceName: dataSource.name,