{"record":{"id":"8d453176626d390a","repo":"hcengineering/platform","slug":"payment-provider-is-not-configured-please-provide","errorCode":null,"errorMessage":"Payment provider is not configured. Please provide payment provider configuration.","messagePattern":"Payment provider is not configured\\. Please provide payment provider configuration\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"services/payment/pod-payment/src/server.ts","lineNumber":171,"sourceCode":"          frontUrl: config.FrontUrl\n        },\n        accountClient,\n        false\n      )\n\n      if (provider !== undefined) {\n        // Register provider-specific endpoints (e.g., webhooks)\n        provider.registerWebhookEndpoints(app, ctx, config.AccountsUrl, serviceToken)\n\n        ctx.info('Stripe payment provider initialized successfully')\n      }\n    } catch (err) {\n      ctx.error('Failed to initialize payment provider Stripe', { err })\n    }\n  }\n\n  if (provider == null) {\n    throw new Error('Payment provider is not configured. Please provide payment provider configuration.')\n  }\n\n  const stopReconciliation = startActiveSubscriptionReconciliation(\n    ctx,\n    config.AccountsUrl,\n    serviceToken,\n    provider,\n    config.ReconciliationIntervalMinutes ?? 60\n  )\n\n  // ============ Generic Payment Service Endpoints ============\n  // These endpoints are provider-agnostic and work with any payment provider\n\n  /**\n   * POST /api/v1/subscriptions/:workspace/subscribe\n   * Create a subscription for a workspace\n   * Body: SubscribeRequest { type: 'tier' | 'support', plan: string, ... }\n   */","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/services/payment/pod-payment/src/server.ts#L153-L189","documentation":"createServer assembles the payment service and initializes the payment provider (currently only Stripe) from configuration. If, after attempting initialization, the provider is still null — because no Stripe config (API key, webhook secret, subscription plans, front URL) was provided or Stripe init threw and was swallowed by the catch block — the server refuses to start and throws this error.","triggerScenarios":"Starting the payment service without the Stripe configuration variables set; Stripe init throwing (invalid API key, missing subscriptionPlans entries) and the catch block logging 'Failed to initialize payment provider Stripe' leaving provider null; config section for the provider absent entirely.","commonSituations":"Deploying without StripeApiKey/StripeSubscriptionPlans env vars; typos in env variable names in docker/k8s manifests; invalid Stripe API key or an incomplete subscriptionPlans string causing the constructor to fail; secret not mounted in the container.","solutions":["Set the required Stripe configuration (API key, webhook secret, subscription plans, front URL) in the service environment and restart","Check service logs for 'Failed to initialize payment provider Stripe' to see the underlying init error (bad key, missing plan config)","Verify secrets are actually mounted/injected in your deployment (k8s secret, docker env file)","Validate the subscriptionPlans string format: semicolon-separated 'plan@type:priceId' entries with all required plans present"],"exampleFix":"// before (env)\n# STRIPE_API_KEY unset\nSTRIPE_WEBHOOK_SECRET=whsec_...\n// after (env)\nSTRIPE_API_KEY=sk_live_...\nSTRIPE_WEBHOOK_SECRET=whsec_...\nSTRIPE_SUBSCRIPTION_PLANS=common@tier:price_abc;rare@tier:price_def;epic@tier:price_ghi;legendary@tier:price_jkl","handlingStrategy":"validation","validationCode":"// run before starting the service\nconst required = ['STRIPE_API_KEY', 'STRIPE_WEBHOOK_SECRET', 'STRIPE_SUBSCRIPTION_PLANS', 'FrontUrl']\nconst missing = required.filter(k => !process.env[k])\nif (missing.length > 0) {\n  throw new Error(`Payment service misconfigured, missing env vars: ${missing.join(', ')}`)\n}","typeGuard":"function hasStripeConfig(c: PaymentConfig | undefined): c is PaymentConfig & { Stripe: { apiKey: string; webhookSecret: string; subscriptionPlans: string } } {\n  return c?.Stripe != null && !!c.Stripe.apiKey && !!c.Stripe.webhookSecret && !!c.Stripe.subscriptionPlans\n}","tryCatchPattern":"try {\n  const server = await createServer(ctx, config)\n  // server: { app, close }\n} catch (err) {\n  if ((err as Error).message.includes('Payment provider is not configured')) {\n    console.error('Payment service cannot start: Stripe configuration missing or invalid. Check env/secret injection.')\n    process.exit(1) // fail fast; orchestration should alert\n  }\n  throw err\n}","preventionTips":["Validate all required env vars at process startup with a config schema (e.g. zod/ajv)","Check deployment manifests (k8s Secret, docker env_file) after every service rename","Inspect logs for 'Failed to initialize payment provider Stripe' — the provider error is swallowed there","Run a smoke test that starts the service in CI with test Stripe keys"],"tags":["configuration","startup","stripe","missing-env-var"],"backgroundTag":"missing-env-var","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}