{"record":{"id":"0efb657ae99fc4c6","repo":"OtterMind/Chat2DB","slug":"pricing-is-disabled-in-community-mode-0efb65","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/misc.ts","lineNumber":12,"sourceCode":"import { BucketTypeEnum, UploadTypeEnum } from '@/typings/upload';\nimport createRequest from './base';\nimport { OrderDetail, CreateOrderResponse } from '@/typings/pricing';\n\nconst testService = createRequest<null, boolean>('/api/system', { errorLevel: false });\nconst systemStop = createRequest<void, void>('/api/system/stop', { errorLevel: false, method: 'post' });\nconst testApiSmooth = createRequest<void, void>('/api/system/get-version-a', { errorLevel: false, method: 'get' });\nconst uploadFile = createRequest<any, string>('/api/file/upload', { method: 'post' });\nconst createOrder =\n  __RUNTIME_ENV__ === 'community'\n    ? async () => {\n        throw new Error('Pricing is disabled in community mode');\n      }\n    : createRequest<{ id: number; seats?: number; invitationCode?: string }, CreateOrderResponse>(\n        '/api/pay/create_order',\n        { method: 'get' },\n      );\nconst getOrder =\n  __RUNTIME_ENV__ === 'community'\n    ? async () => {\n        throw new Error('Pricing is disabled in community mode');\n      }\n    : createRequest<{ orderId: string }, OrderDetail>('/api/pay/get_order_status_a', { method: 'get' });\n\n/** Upload CSS */\nconst getOSSCertificate = createRequest<\n  {\n    bucketType: BucketTypeEnum;\n    uploadType: UploadTypeEnum;\n  },","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-client/src/service/misc.ts#L1-L30","documentation":"In service/misc.ts, createOrder is conditionally replaced with a throwing async function when __RUNTIME_ENV__ === 'community'. The real createOrder calls POST /api/pay/create_order; the Community stub throws 'Pricing is disabled in community mode'. This is the same product-contract boundary as the dedicated pricing service but centralized in the misc service module for order creation specifically.","triggerScenarios":"Calling createOrder({ id, seats, invitationCode }) in a Community build. This is typically triggered by a billing/upgrade flow or a pricing modal that wasn't gated behind an edition check.","commonSituations":"A shared upgrade button visible in Community. A billing page reachable via deep link in Community. Code refactored from Enterprise without auditing createOrder call sites.","solutions":["Gate createOrder call sites behind __RUNTIME_ENV__ !== 'community'.","Hide/disable the upgrade and billing UI in Community builds.","Wrap in try/catch and show 'not available in Community edition' on error."],"exampleFix":"// before\nconst result = await createOrder({ id, seats });\n\n// after\nif (__RUNTIME_ENV__ === 'community') {\n  message.info('Billing is not available in Community edition');\n  return;\n}\nconst result = await createOrder({ id, seats });","handlingStrategy":"validation","validationCode":"if (__RUNTIME_ENV__ === 'community') {\n  message.info('Order creation is not available in Community edition');\n  return;\n}\nawait createOrder({ id, seats });","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Hide the upgrade/billing CTA in Community via edition-conditional rendering.","Route-guard billing pages to Enterprise.","Add Community-specific smoke tests covering billing flows."],"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"}