{"record":{"id":"71dcd2367e9490d3","repo":"Budibase/budibase","slug":"no-google-configuration-found","errorCode":null,"errorMessage":"No google configuration found","messagePattern":"No google configuration found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/backend-core/src/middleware/passport/datasource/google.ts","lineNumber":19,"sourceCode":"import * as google from \"../sso/google\"\nimport { Cookie } from \"../../../constants\"\nimport * as configs from \"../../../configs\"\nimport * as cache from \"../../../cache\"\nimport * as utils from \"../../../utils\"\nimport { UserCtx, SSOProfile } from \"@budibase/types\"\nimport { ssoSaveUserNoOp } from \"../sso/sso\"\n\nconst GoogleStrategy = require(\"passport-google-oauth\").OAuth2Strategy\n\ntype Passport = {\n  authenticate: any\n}\n\nasync function fetchGoogleCreds() {\n  let config = await configs.getGoogleDatasourceConfig()\n\n  if (!config) {\n    throw new Error(\"No google configuration found\")\n  }\n  return config\n}\n\nexport async function preAuth(\n  passport: Passport,\n  ctx: UserCtx,\n  next: Function\n) {\n  // get the relevant config\n  const googleConfig = await fetchGoogleCreds()\n  const platformUrl = await configs.getPlatformUrl({ tenantAware: false })\n\n  let callbackUrl = `${platformUrl}/api/global/auth/datasource/google/callback`\n  const strategy = await google.strategyFactory(\n    googleConfig,\n    callbackUrl,\n    ssoSaveUserNoOp","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/backend-core/src/middleware/passport/datasource/google.ts#L1-L37","documentation":"fetchGoogleCreds loads the Google datasource configuration from the config store and throws 'No google configuration found' when none exists. Google OAuth datasource flows cannot proceed without stored clientID/clientSecret configuration.","triggerScenarios":"Starting a Google datasource OAuth flow (preAuth/authenticate) before any Google datasource config has been saved for the tenant/app, or after the config was deleted.","commonSituations":"Fresh environment where Google Cloud OAuth credentials were never entered; config stored under a different type/tenant; migration losing configs DB documents; typo'd datasource config creation.","solutions":["Create and save the Google datasource config (clientID + clientSecret) in the builder before initiating auth","Verify the config was saved under the correct tenant/production app","Check configs DB (providers config documents) contains the google datasource doc","Re-create the Google datasource if the underlying config document was removed"],"exampleFix":"// before\nconst strategy = await google.config(ctx) // throws if unconfigured\n// after\nconst cfg = await configs.getGoogleDatasourceConfig()\nif (!cfg) {\n  await configs.saveGoogleDatasourceConfig({ clientID, clientSecret })\n}\nconst strategy = await google.config(ctx)","handlingStrategy":"fallback","validationCode":"const cfg = await configs.getGoogleDatasourceConfig()\nif (!cfg?.clientID || !cfg?.clientSecret) {\n  throw new Error(\"Save Google datasource credentials before authenticating\")\n}","typeGuard":null,"tryCatchPattern":"try {\n  await fetchGoogleCreds()\n  // continue OAuth flow\n} catch (e) {\n  if (e.message === \"No google configuration found\") {\n    return ctx.redirect(\"/settings/datasources/google\") // prompt setup\n  }\n  throw e\n}","preventionTips":["Check config presence before rendering the 'Connect Google' UI","Recreate the config after tenant/app migrations","Back up the configs DB as part of environment provisioning"],"tags":["google","oauth","configuration","missing-config"],"backgroundTag":"missing-oauth-configuration","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}