FlowiseAI/Flowise · error · Error

Stripe manager is not initialized

Error message

Stripe manager is not initialized

What it means

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.

Source

Thrown at packages/server/src/IdentityManager.ts:256

                    break
                }
                default:
                    throw new Error(`SSO Provider ${providerName} not found`)
            }
        }
    }

    async getRefreshToken(providerName: any, ssoRefreshToken: string) {
        if (!this.ssoProviders.has(providerName)) {
            throw new Error(`SSO Provider ${providerName} not found`)
        }
        return await (this.ssoProviders.get(providerName) as SSOBase).refreshToken(ssoRefreshToken)
    }

    public async getProductIdFromSubscription(subscriptionId: string) {
        if (!subscriptionId) return ''
        if (!this.stripeManager) {
            throw new Error('Stripe manager is not initialized')
        }
        return await this.stripeManager.getProductIdFromSubscription(subscriptionId)
    }

    public async getFeaturesByPlan(subscriptionId: string, withoutCache: boolean = false) {
        if (this.isEnterprise()) {
            const features: Record<string, string> = {}
            for (const feature of ENTERPRISE_FEATURE_FLAGS) {
                features[feature] = 'true'
            }
            return features
        } else if (this.isCloud()) {
            if (!this.stripeManager || !subscriptionId) {
                return {}
            }
            return await this.stripeManager.getFeaturesByPlan(subscriptionId, withoutCache)
        }
        return {}

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Set process.env.STRIPE_SECRET_KEY (and related CLOUD_*_ID envs) in the deployment environment and restart.
  2. Guard billing routes with IdentityManager.isCloud()/isEnterprise() so they are unreachable on platforms without Stripe.
  3. Check that initialize() completed without error — an earlier throw leaves stripeManager undefined even when the key is present.
  4. Verify the secret actually reaches the process (print its presence, never its value) in startup logs.

Example fix

// before
const productId = await identityManager.getProductIdFromSubscription(subId) // throws on OSS

// after
if (!identityManager.isCloud() && !identityManager.isEnterprise()) {
    return res.status(403).json({ message: 'Billing not available on this platform' })
}
const productId = await identityManager.getProductIdFromSubscription(subId)
Defensive patterns

Strategy: validation

Validate before calling

if (!identityManager.isCloud() && !identityManager.isEnterprise()) {
    return res.status(403).json({ message: 'Billing not available on this platform' })
}
const productId = await identityManager.getProductIdFromSubscription(subId)

Type guard

const hasStripeManager = (im: IdentityManager): boolean => Boolean(im.stripeManager)

Try / catch

try {
    const productId = await identityManager.getProductIdFromSubscription(subId)
} catch (e) {
    if ((e as Error).message === 'Stripe manager is not initialized') {
        return res.status(503).json({ message: 'Billing is not configured' })
    }
    throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/e177fdf3b7d02e5b. Report an issue: GitHub.