{"record":{"id":"e177fdf3b7d02e5b","repo":"FlowiseAI/Flowise","slug":"stripe-manager-is-not-initialized","errorCode":null,"errorMessage":"Stripe manager is not initialized","messagePattern":"Stripe manager is not initialized","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/IdentityManager.ts","lineNumber":256,"sourceCode":"                    break\n                }\n                default:\n                    throw new Error(`SSO Provider ${providerName} not found`)\n            }\n        }\n    }\n\n    async getRefreshToken(providerName: any, ssoRefreshToken: string) {\n        if (!this.ssoProviders.has(providerName)) {\n            throw new Error(`SSO Provider ${providerName} not found`)\n        }\n        return await (this.ssoProviders.get(providerName) as SSOBase).refreshToken(ssoRefreshToken)\n    }\n\n    public async getProductIdFromSubscription(subscriptionId: string) {\n        if (!subscriptionId) return ''\n        if (!this.stripeManager) {\n            throw new Error('Stripe manager is not initialized')\n        }\n        return await this.stripeManager.getProductIdFromSubscription(subscriptionId)\n    }\n\n    public async getFeaturesByPlan(subscriptionId: string, withoutCache: boolean = false) {\n        if (this.isEnterprise()) {\n            const features: Record<string, string> = {}\n            for (const feature of ENTERPRISE_FEATURE_FLAGS) {\n                features[feature] = 'true'\n            }\n            return features\n        } else if (this.isCloud()) {\n            if (!this.stripeManager || !subscriptionId) {\n                return {}\n            }\n            return await this.stripeManager.getFeaturesByPlan(subscriptionId, withoutCache)\n        }\n        return {}","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/IdentityManager.ts#L238-L274","documentation":"Thrown by IdentityManager.getProductIdFromSubscription() when this.stripeManager is undefined. stripeManager is only assigned during initialize() when process.env.STRIPE_SECRET_KEY is set; if that env var is absent, stripeManager stays undefined and every billing method that depends on it throws this guard. The method maps a subscription id to its product id via Stripe, so without the manager there is no Stripe client to query.","triggerScenarios":"Running an Open Source or Enterprise self-hosted instance without STRIPE_SECRET_KEY configured, then hitting a billing/subscription API that calls getProductIdFromSubscription. Also occurs if initialize() threw before reaching the Stripe init block, leaving stripeManager unset despite the env var.","commonSituations":"Local dev without Stripe env; a deployment missing the STRIPE_SECRET_KEY secret; calling a cloud-only billing route on a non-cloud platform; initialize() failing earlier (e.g. license error) so the Stripe block never ran.","solutions":["Set process.env.STRIPE_SECRET_KEY (and related CLOUD_*_ID envs) in the deployment environment and restart.","Guard billing routes with IdentityManager.isCloud()/isEnterprise() so they are unreachable on platforms without Stripe.","Check that initialize() completed without error — an earlier throw leaves stripeManager undefined even when the key is present.","Verify the secret actually reaches the process (print its presence, never its value) in startup logs."],"exampleFix":"// before\nconst productId = await identityManager.getProductIdFromSubscription(subId) // throws on OSS\n\n// after\nif (!identityManager.isCloud() && !identityManager.isEnterprise()) {\n    return res.status(403).json({ message: 'Billing not available on this platform' })\n}\nconst productId = await identityManager.getProductIdFromSubscription(subId)","handlingStrategy":"validation","validationCode":"if (!identityManager.isCloud() && !identityManager.isEnterprise()) {\n    return res.status(403).json({ message: 'Billing not available on this platform' })\n}\nconst productId = await identityManager.getProductIdFromSubscription(subId)","typeGuard":"const hasStripeManager = (im: IdentityManager): boolean => Boolean(im.stripeManager)","tryCatchPattern":"try {\n    const productId = await identityManager.getProductIdFromSubscription(subId)\n} catch (e) {\n    if ((e as Error).message === 'Stripe manager is not initialized') {\n        return res.status(503).json({ message: 'Billing is not configured' })\n    }\n    throw e\n}","preventionTips":["Set STRIPE_SECRET_KEY in every environment that runs billing routes.","Gate billing endpoints behind platform checks so they 403 on OSS.","Verify at boot that initialize() completed (check for earlier throws)."],"tags":["stripe","billing","config","environment","subscription"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}