OtterMind/Chat2DB · warning · Error

Pricing is disabled in community mode

Error message

Pricing is disabled in community mode

What it means

This is the runtime-conditional version in service/pricing.ts (the live service module, not the community-stubs). When __RUNTIME_ENV__ === 'community', pricingServices.createOrder is a throwing async function instead of the real createRequest to POST /api/product/order. Identical product-contract boundary to the stub, but selected at build time via the constant.

Source

Thrown at chat2db-community-client/src/service/pricing.ts:11

import createRequest from './base';
import { ProductDetailVO, OrderDetail, CreateOrderResponse } from '@/typings/pricing';
import { PayType } from '@/constants/pricing';
import { OrganizationType } from '@/typings/enterprise/organization';

const pricingServices =
  __RUNTIME_ENV__ === 'community'
    ? {
        getProductList: async () => [] as ProductDetailVO[],
        createOrder: async () => {
          throw new Error('Pricing is disabled in community mode');
        },
        getOrder: async () => {
          throw new Error('Pricing is disabled in community mode');
        },
        getOrderList: async () => [],
        cancelSubscription: async () => undefined,
      }
    : (() => {
        const getProductList = createRequest<
          { version?: 2; subscriptionTypes?: any; orgType?: OrganizationType; language?: string },
          ProductDetailVO[]
        >('/api/product/list', { errorLevel: false });

        const createOrder = createRequest<
          {
            id: number;
            paymentMethod?: PayType;
            invitationCode?: string;

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Gate the pricing page / checkout button behind __RUNTIME_ENV__ !== 'community'.
  2. Wrap the call in try/catch and show a Community-appropriate message.
  3. Audit all pricingServices.createOrder call sites for edition guards.

Example fix

// before
await pricingServices.createOrder(params);

// after
if (__RUNTIME_ENV__ === 'community') {
  return;
}
await pricingServices.createOrder(params);
Defensive patterns

Strategy: validation

Validate before calling

if (__RUNTIME_ENV__ === 'community') {
  return;
}
await pricingServices.createOrder(params);

Prevention

When it happens

Trigger: Calling pricingServices.createOrder(...) in a Community build. Triggered by a checkout flow or pricing page that renders in Community without edition gating.

Common situations: Pricing/upgrade UI not hidden in Community. A shared component calls createOrder unconditionally. Build misconfigured so __RUNTIME_ENV__ resolves to 'community' while UI assumes Enterprise.

Related errors


AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14). Data as JSON: /api/errors/dac8c61e5a7c3cb2. Report an issue: GitHub.