{"record":{"id":"612be452f94adcfd","repo":"linshenkx/prompt-optimizer","slug":"google-drive-oauth-client-is-not-configured","errorCode":null,"errorMessage":"Google Drive OAuth client is not configured","messagePattern":"Google Drive OAuth client is not configured","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ui/src/utils/remote-backup.ts","lineNumber":1241,"sourceCode":"    headers.set('Authorization', `Bearer ${token}`)\n    const requestInit = { ...init, headers }\n    if (options?.downloadRetry) {\n      return fetchGoogleDriveDownloadWithRetry(String(url), requestInit, context, {\n        returnAuthFailures: true,\n      })\n    }\n    return fetch(url, requestInit)\n  }\n\n  private clearAccessToken(clientId: string): void {\n    this.accessTokenEntry = null\n    googleAccessTokenCache.delete(clientId)\n  }\n\n  private async ensureAccessToken(options?: { forceRefresh?: boolean }): Promise<string> {\n    const clientId = resolveGoogleDriveClientId()\n    if (!clientId) {\n      throw new Error('Google Drive OAuth client is not configured')\n    }\n\n    if (options?.forceRefresh) {\n      this.clearAccessToken(clientId)\n    }\n\n    if (!options?.forceRefresh && isGoogleAccessTokenUsable(this.accessTokenEntry)) {\n      return this.accessTokenEntry.accessToken\n    }\n\n    const cached = googleAccessTokenCache.get(clientId)\n    if (!options?.forceRefresh && isGoogleAccessTokenUsable(cached)) {\n      this.accessTokenEntry = cached\n      return cached.accessToken\n    }\n    if (cached) googleAccessTokenCache.delete(clientId)\n\n    await loadGoogleIdentityScript()","sourceCodeStart":1223,"sourceCodeEnd":1259,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/ui/src/utils/remote-backup.ts#L1223-L1259","documentation":"The Google Drive provider resolves an OAuth client id via resolveGoogleDriveClientId(); if none is configured it throws before attempting any token flow. Without a client id no Google auth can happen.","triggerScenarios":"Creating/using a google-drive RemoteObjectStore in an environment where the Google client id env var/build flag is missing — e.g. local dev without VITE_GOOGLE_CLIENT_ID or the bundled build stripped it.","commonSituations":"New clone without .env; CI build missing secrets; deploying the web app without configuring the Google OAuth client.","solutions":["Set the Google OAuth client id env var used by resolveGoogleDriveClientId (check build config for the exact name, e.g. VITE_GOOGLE_DRIVE_CLIENT_ID) and rebuild","Verify the env var is present at runtime in the deployed environment (import.meta.env)","Create a Google OAuth client in Google Cloud Console if none exists"],"exampleFix":"# before\n# .env missing\n# after\nVITE_GOOGLE_DRIVE_CLIENT_ID=xxxxxxxx.apps.googleusercontent.com","handlingStrategy":"validation","validationCode":"const hasClientId = Boolean(import.meta.env.VITE_GOOGLE_DRIVE_CLIENT_ID)\nif (hasClientId) enableGoogleDriveBackup()","typeGuard":null,"tryCatchPattern":"catch (e) { if ((e as Error).message.includes('OAuth client is not configured')) showConfigNotice(); else throw e }","preventionTips":["Fail fast on missing env at startup","Keep OAuth client id in deployment checklist"],"tags":["google-drive","oauth","configuration","missing-env-var"],"backgroundTag":"missing-env-var","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}