{"record":{"id":"749c8c13f5798976","repo":"Budibase/budibase","slug":"no-recaptcha-config-found","errorCode":null,"errorMessage":"No recaptcha config found","messagePattern":"No recaptcha config found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/server/src/api/controllers/recaptcha.ts","lineNumber":26,"sourceCode":"import { utils, Cookie, configs, UnexpectedError } from \"@budibase/backend-core\"\nimport {\n  setRecaptchaVerified,\n  isRecaptchaVerified,\n} from \"../../utilities/redis\"\nimport fetch from \"node-fetch\"\n\nexport async function verify(\n  ctx: Ctx<VerifyRecaptchaRequest, VerifyRecaptchaResponse>\n) {\n  const { token } = ctx.request.body\n\n  if (!token) {\n    throw new Error(\"Recaptcha token not found\")\n  }\n\n  const config = await configs.getRecaptchaConfig()\n  if (!config) {\n    throw new Error(\"No recaptcha config found\")\n  }\n\n  try {\n    const response = await fetch(\n      \"https://www.google.com/recaptcha/api/siteverify\",\n      {\n        method: \"POST\",\n        headers: {\n          \"Content-Type\": \"application/x-www-form-urlencoded\",\n        },\n        body: new URLSearchParams({\n          secret: config.config.secretKey,\n          response: token,\n        }),\n      }\n    )\n\n    const { success } = await response.json()","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/api/controllers/recaptcha.ts#L8-L44","documentation":"After a token is present, `verify` loads the reCAPTCHA configuration via `configs.getRecaptchaConfig()`. If no reCAPTCHA config exists (never set up, or not enabled for the tenant/app), the endpoint throws because verification cannot proceed without the site secret. The config must be created in config management before this endpoint can be used.","triggerScenarios":"Calling the verify endpoint in an environment where the reCAPTCHA config was never created, the config is disabled, the tenant scoping means the config isn't visible to the current app, or the config was recently deleted.","commonSituations":"Deploying to a new environment without migrating config settings; config stored per-tenant and the request lacks the right tenant/workspace context; feature flag or plan tier that excludes the reCAPTCHA config; testing locally where settings were never populated.","solutions":["Create/enable the reCAPTCHA config with a valid site key and secret via the config endpoints/UI","Confirm the request runs in the tenant/workspace where the config exists","Check the config is not disabled or expired","Compare environment variables (e.g. MULTI_TENANCY settings) to ensure the config lookup targets the right scope"],"exampleFix":"// before\n// call verify with no config set up -> 500\n// after (setup step first)\nawait api.post(\"/api/global/configs\", { type: \"recaptcha\", config: { siteKey, secretKey } })\nawait verifyRecaptcha({ token })","handlingStrategy":"validation","validationCode":"const cfg = await api.get(\"/api/global/configs\").then(r => r.find(c => c.type === \"recaptcha\"))\nif (!cfg) throw new Error(\"Configure reCAPTCHA before calling verify\")","typeGuard":"const hasRecaptchaConfig = (configs) => Array.isArray(configs) && configs.some(c => c.type === \"recaptcha\" && c.config && c.config.secretKey)","tryCatchPattern":"try {\n  await verifyRecaptcha({ token })\n} catch (e) {\n  if (String(e.message).includes(\"No recaptcha config found\")) {\n    // guide admin to settings -> reCAPTCHA config\n  }\n}","preventionTips":["Provision the reCAPTCHA config as part of environment setup","Check config existence at app startup and surface a setup prompt","Keep configs in sync across dev/staging/prod","Verify multi-tenancy context headers are sent with config-dependent requests"],"tags":["recaptcha","configuration","missing-config"],"backgroundTag":"missing-env-var","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}