{"record":{"id":"dac8c61e5a7c3cb2","repo":"OtterMind/Chat2DB","slug":"pricing-is-disabled-in-community-mode-dac8c6","errorCode":null,"errorMessage":"Pricing is disabled in community mode","messagePattern":"Pricing is disabled in community mode","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"chat2db-community-client/src/service/pricing.ts","lineNumber":11,"sourceCode":"import createRequest from './base';\nimport { ProductDetailVO, OrderDetail, CreateOrderResponse } from '@/typings/pricing';\nimport { PayType } from '@/constants/pricing';\nimport { OrganizationType } from '@/typings/enterprise/organization';\n\nconst pricingServices =\n  __RUNTIME_ENV__ === 'community'\n    ? {\n        getProductList: async () => [] as ProductDetailVO[],\n        createOrder: async () => {\n          throw new Error('Pricing is disabled in community mode');\n        },\n        getOrder: async () => {\n          throw new Error('Pricing is disabled in community mode');\n        },\n        getOrderList: async () => [],\n        cancelSubscription: async () => undefined,\n      }\n    : (() => {\n        const getProductList = createRequest<\n          { version?: 2; subscriptionTypes?: any; orgType?: OrganizationType; language?: string },\n          ProductDetailVO[]\n        >('/api/product/list', { errorLevel: false });\n\n        const createOrder = createRequest<\n          {\n            id: number;\n            paymentMethod?: PayType;\n            invitationCode?: string;","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-client/src/service/pricing.ts#L1-L29","documentation":"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.","triggerScenarios":"Calling pricingServices.createOrder(...) in a Community build. Triggered by a checkout flow or pricing page that renders in Community without edition gating.","commonSituations":"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.","solutions":["Gate the pricing page / checkout button behind __RUNTIME_ENV__ !== 'community'.","Wrap the call in try/catch and show a Community-appropriate message.","Audit all pricingServices.createOrder call sites for edition guards."],"exampleFix":"// before\nawait pricingServices.createOrder(params);\n\n// after\nif (__RUNTIME_ENV__ === 'community') {\n  return;\n}\nawait pricingServices.createOrder(params);","handlingStrategy":"validation","validationCode":"if (__RUNTIME_ENV__ === 'community') {\n  return;\n}\nawait pricingServices.createOrder(params);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate pricing/checkout UI behind edition checks.","Centralize pricing access behind an edition-aware service wrapper.","Audit call sites when introducing Community builds."],"tags":["community-mode","pricing","billing","runtime-env","frontend"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}