From 4408a7b02a6eeaab518d11db7d32beb2d04b05de Mon Sep 17 00:00:00 2001 From: Mitch Goudy Date: Thu, 21 May 2026 10:25:28 -0600 Subject: [PATCH 1/2] fix(drive-integration): handle google-docs-not-found workflow failure reason Adds GOOGLE_DOCS_NOT_FOUND to WorkflowFailureReason and wires it through the hook and error modal so users see "Document not found" with an actionable message instead of the generic error screen. Co-Authored-By: Claude Sonnet 4.6 --- apps/drive-integration/src/hooks/useWorkflowAgent.ts | 8 ++++++++ .../Page/components/mainpage/ModalOrchestrator.tsx | 12 ++++++++++++ apps/drive-integration/src/types/workflow.ts | 1 + .../src/utils/constants/messages.ts | 2 ++ 4 files changed, 23 insertions(+) diff --git a/apps/drive-integration/src/hooks/useWorkflowAgent.ts b/apps/drive-integration/src/hooks/useWorkflowAgent.ts index 8d35961c28..1c5c51d4fc 100644 --- a/apps/drive-integration/src/hooks/useWorkflowAgent.ts +++ b/apps/drive-integration/src/hooks/useWorkflowAgent.ts @@ -123,6 +123,10 @@ const getBackendWorkflowFailureReason = (runData: AgentRunData): WorkflowFailure return WorkflowFailureReason.GOOGLE_DRIVE_AUTH_EXPIRED; } + if (workflowFailure.code === WorkflowFailureReason.GOOGLE_DOCS_NOT_FOUND) { + return WorkflowFailureReason.GOOGLE_DOCS_NOT_FOUND; + } + if (workflowFailure.code === WorkflowFailureReason.GENERIC) { return WorkflowFailureReason.GENERIC; } @@ -138,6 +142,10 @@ const getWorkflowFailureMessage = ( return ERROR_MESSAGES.GOOGLE_DRIVE_AUTH_ERROR; } + if (failureReason === WorkflowFailureReason.GOOGLE_DOCS_NOT_FOUND) { + return ERROR_MESSAGES.GOOGLE_DOCS_NOT_FOUND; + } + return getRunErrorMessage(runData); }; diff --git a/apps/drive-integration/src/locations/Page/components/mainpage/ModalOrchestrator.tsx b/apps/drive-integration/src/locations/Page/components/mainpage/ModalOrchestrator.tsx index 1311789f2e..ecfc233ba3 100644 --- a/apps/drive-integration/src/locations/Page/components/mainpage/ModalOrchestrator.tsx +++ b/apps/drive-integration/src/locations/Page/components/mainpage/ModalOrchestrator.tsx @@ -163,6 +163,18 @@ export const ModalOrchestrator = forwardRef Date: Thu, 21 May 2026 11:42:49 -0600 Subject: [PATCH 2/2] fix(drive-integration): read Google Picker API key and app ID from env vars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GOOGLE_PICKER_API_KEY and GOOGLE_APP_ID were hardcoded (empty string and 1 respectively), causing the Google Picker to not reliably show files the user owns — especially newly created docs. Reads from VITE_GOOGLE_PICKER_API_KEY and VITE_GOOGLE_APP_ID env vars instead, and wires them into CI build steps. The actual values must be added to CircleCI project environment variables: - VITE_GOOGLE_PICKER_API_KEY: from GCP > APIs & Services > Credentials > Drive Integration API key - VITE_GOOGLE_APP_ID: 991777691184 (Contentful Google Docs App project number) Co-Authored-By: Claude Sonnet 4.6 --- .circleci/config.yml | 4 ++++ apps/drive-integration/.env.example | 6 ++++++ apps/drive-integration/src/hooks/useGoogleDocPicker.tsx | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 53c5a8c658..8b7d0ae1fd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -122,6 +122,8 @@ jobs: VITE_ENV='test' \ REACT_APP_BACKEND_BASE_URL=$BACKEND_BASE_URL_TEST \ REACT_APP_SLACK_CLIENT_ID=$SLACK_CLIENT_ID_TEST \ + VITE_GOOGLE_PICKER_API_KEY=$VITE_GOOGLE_PICKER_API_KEY \ + VITE_GOOGLE_APP_ID=$VITE_GOOGLE_APP_ID \ NODE_ENV='staging' \ npm run build - run: @@ -165,6 +167,8 @@ jobs: command: | REACT_APP_BACKEND_BASE_URL=$APP_SLACK_BACKEND_BASE_URL_PROD \ REACT_APP_SLACK_CLIENT_ID=$SLACK_CLIENT_ID_PROD \ + VITE_GOOGLE_PICKER_API_KEY=$VITE_GOOGLE_PICKER_API_KEY \ + VITE_GOOGLE_APP_ID=$VITE_GOOGLE_APP_ID \ NODE_ENV='production' \ npm run build - publish diff --git a/apps/drive-integration/.env.example b/apps/drive-integration/.env.example index 4908c1ded4..4d709d9b5c 100644 --- a/apps/drive-integration/.env.example +++ b/apps/drive-integration/.env.example @@ -12,3 +12,9 @@ VITE_ENABLE_MOCK_EDIT_MODAL= # Frontend (Vite): opt in to a local Agents API during development. VITE_LOCAL_AGENTS_API_BASE_URL= + +# Frontend (Vite): Google Picker API key (from GCP > APIs & Services > Credentials > Drive Integration API key). +VITE_GOOGLE_PICKER_API_KEY= + +# Frontend (Vite): Google Cloud project number (991777691184 for the Contentful Google Docs App project). +VITE_GOOGLE_APP_ID= diff --git a/apps/drive-integration/src/hooks/useGoogleDocPicker.tsx b/apps/drive-integration/src/hooks/useGoogleDocPicker.tsx index 3a37b8a197..ff4faca206 100644 --- a/apps/drive-integration/src/hooks/useGoogleDocPicker.tsx +++ b/apps/drive-integration/src/hooks/useGoogleDocPicker.tsx @@ -15,9 +15,9 @@ type UseGoogleDocsPickerOptions = { onCancel?: () => void; }; -const GOOGLE_PICKER_API_KEY = ''; +const GOOGLE_PICKER_API_KEY = import.meta.env.VITE_GOOGLE_PICKER_API_KEY ?? ''; -const GOOGLE_APP_ID = 1; +const GOOGLE_APP_ID = import.meta.env.VITE_GOOGLE_APP_ID ?? ''; // These are already exposed by google in the network even if they were hidden as environment variables // and google acknowledges that these are okay to be public and that restrictions come from defining the