{"record":{"id":"7ccc0a129cf840b5","repo":"Budibase/budibase","slug":"google-config-not-found","errorCode":null,"errorMessage":"Google config not found","messagePattern":"Google config not found","errorType":"http","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/integrations/googlesheets.ts","lineNumber":243,"sourceCode":"        `Error authenticating with google sheets. ${json.error_description}`\n      )\n    }\n\n    return json\n  }\n\n  private async connect() {\n    try {\n      const bbCtx = context.getCurrentContext()\n      let oauthClient = bbCtx?.googleSheets?.oauthClient\n\n      if (!oauthClient) {\n        await setupCreationAuth(this.config)\n\n        // Initialise oAuth client\n        const googleConfig = await configs.getGoogleDatasourceConfig()\n        if (!googleConfig) {\n          throw new HTTPError(\"Google config not found\", 400)\n        }\n\n        oauthClient = new OAuth2Client({\n          clientId: googleConfig.clientID,\n          clientSecret: googleConfig.clientSecret,\n        })\n\n        const tokenResponse = await this.fetchAccessToken({\n          client_id: googleConfig.clientID,\n          client_secret: googleConfig.clientSecret,\n          refresh_token: this.config.auth.refreshToken,\n        })\n\n        oauthClient.setCredentials({\n          refresh_token: this.config.auth.refreshToken,\n          access_token: tokenResponse.access_token,\n        })\n        if (bbCtx && !bbCtx.googleSheets) {","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/integrations/googlesheets.ts#L225-L261","documentation":"connect() loads the workspace's Google datasource OAuth configuration from the config store and initialises an OAuth2Client. If no Google config exists (no clientID/clientSecret registered), setup cannot proceed and it throws HTTPError 400. This is a workspace-level configuration prerequisite for any Google Sheets operation.","triggerScenarios":"Calling connect — and anything that depends on it: testConnection, getTableNames, buildSchema, createTable, updateTable, deleteTable — when configs.getGoogleDatasourceConfig() returns null/undefined, i.e. no Google OAuth client config has been created in the environment.","commonSituations":"Self-hosted install where the Google OAuth client config was never set up (required env/config step skipped); config store cleared or migrated to a new DB; wrong tenant/workspace queried so the config lookup misses; production env lacking the setup that existed locally.","solutions":["Complete the Google OAuth setup for the environment so getGoogleDatasourceConfig() returns a config (clientID + clientSecret)","Verify the config store (DB) actually contains the Google datasource config document for the current tenant","Check that environment variables used to seed the Google config are set on the server","Confirm the request is hitting the tenant/workspace where the config was created, not a different one"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import configs from './configs'\nasync function ensureGoogleConfig() {\n  const googleConfig = await configs.getGoogleDatasourceConfig()\n  if (!googleConfig || !googleConfig.clientID || !googleConfig.clientSecret) {\n    throw new HTTPError('Google OAuth config missing — complete environment setup first', 400)\n  }\n  return googleConfig\n}","typeGuard":"function hasGoogleConfig(c) {\n  return c != null && typeof c.clientID === 'string' && typeof c.clientSecret === 'string'\n}","tryCatchPattern":"try {\n  await integration.connect()\n} catch (err) {\n  if (err.status === 400 && err.message === 'Google config not found') {\n    // run the Google OAuth environment setup / guide admin to configure it\n  } else throw err\n}","preventionTips":["Run the Google OAuth setup step as part of environment bootstrap/self-host install","Add a health/config check endpoint that surfaces missing Google config early","Keep config store backups so migration doesn't drop the Google config doc","Confirm tenant context is correct before config lookups"],"tags":["google-sheets","oauth","configuration","missing-config"],"backgroundTag":"missing-required-config","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}