{"record":{"id":"709fc27c02e3f97a","repo":"Significant-Gravitas/AutoGPT","slug":"payment-redirect-urls-cannot-be-validated-fronten","errorCode":null,"errorMessage":"Payment redirect URLs cannot be validated: frontend_base_url or platform_base_url must be set on the server.","messagePattern":"Payment redirect URLs cannot be validated: frontend_base_url or platform_base_url must be set on the server\\.","errorType":"http","errorClass":"HTTPException","httpStatus":503,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/v1.py","lineNumber":1315,"sourceCode":"        raise HTTPException(\n            status_code=422,\n            detail=\"success_url and cancel_url are required for paid tier upgrades\",\n        )\n    # Open-redirect protection: both URLs must point to the configured frontend\n    # origin, otherwise an attacker could use our Stripe integration as a\n    # redirector to arbitrary phishing sites.\n    #\n    # Fail early with a clear 503 if the server is misconfigured (neither\n    # frontend_base_url nor platform_base_url set), so operators get an\n    # actionable error instead of the misleading \"must match the platform\n    # frontend origin\" 422 that _validate_checkout_redirect_url would otherwise\n    # produce when `allowed` is empty.\n    if not (settings.config.frontend_base_url or settings.config.platform_base_url):\n        logger.error(\n            \"update_subscription_tier: neither frontend_base_url nor \"\n            \"platform_base_url is configured; cannot validate checkout redirect URLs\"\n        )\n        raise HTTPException(\n            status_code=503,\n            detail=(\n                \"Payment redirect URLs cannot be validated: \"\n                \"frontend_base_url or platform_base_url must be set on the server.\"\n            ),\n        )\n    if not _validate_checkout_redirect_url(\n        request.success_url\n    ) or not _validate_checkout_redirect_url(request.cancel_url):\n        raise HTTPException(\n            status_code=422,\n            detail=\"success_url and cancel_url must match the platform frontend origin\",\n        )\n    try:\n        url = await create_subscription_checkout(\n            user_id=user_id,\n            tier=tier,\n            success_url=request.success_url,","sourceCodeStart":1297,"sourceCodeEnd":1333,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/v1.py#L1297-L1333","documentation":"Raised (503) by the update_subscription_tier checkout endpoint when neither settings.config.frontend_base_url nor settings.config.platform_base_url is set. The server refuses to create Stripe checkout sessions because success_url/cancel_url validation against an allow-list of origins is impossible without a configured base URL, and proceeding would allow redirecting users to arbitrary phishing sites. It is a deliberate fail-fast guard so operators get an actionable 503 instead of a misleading 422.","triggerScenarios":"POST to /credits/checkout-style subscription tier upgrade endpoint (update_subscription_tier) while the backend process has both frontend_base_url and platform_base_url empty/unset in its AppConfiguration — e.g. a fresh deployment, local dev without .env, or a staging server missing PLATFORM_BASE_URL/FRONTEND_BASE_URL env vars.","commonSituations":"New environment bootstrap where .env was copied incompletely; docker-compose started without the platform_base_url variable; CI/smoke tests hitting the payments endpoint on a bare config; renaming or removing the env var during config refactors.","solutions":["Set frontend_base_url (or platform_base_url) in the backend configuration (env var / .env / App config) to the origin the frontend is served from, e.g. PLATFORM_BASE_URL=https://app.example.com, then restart the backend.","Verify with a health/config dump or by checking process env that the running server actually sees the variable (not just your shell).","If you intentionally run payments-disabled, block or stub the subscription route at the gateway so clients get a clearer 'payments unavailable' signal."],"exampleFix":"# before (backend .env missing both)\n# (no base URL configured -> 503 on checkout)\n\n# after\nFRONTEND_BASE_URL=http://localhost:3000\n# or\nPLATFORM_BASE_URL=https://app.example.com","handlingStrategy":"validation","validationCode":"// before calling the tier-upgrade endpoint\nconst health = await fetch('/health').then(r => r.json());\nif (!health.config?.frontend_base_url && !health.config?.platform_base_url) {\n  showBanner('Payments are not configured on this server.');\n}","typeGuard":null,"tryCatchPattern":"try { await api.updateSubscriptionTier(...) } catch (e) { if (e.response?.status === 503 && /frontend_base_url|platform_base_url/.test(e.response.data.detail)) { reportServerMisconfiguration(); } else { throw e; } }","preventionTips":["Include frontend_base_url (or platform_base_url) in every environment's required-vars checklist and fail startup checks if payments are enabled without it.","Add a deployment smoke test that hits the checkout endpoint and asserts non-503.","Surface misconfiguration errors distinctly in the UI so users do not retry a server-side problem."],"tags":["configuration","payments","stripe","http-503","deployment"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}