{"record":{"id":"5bc2703ef4e20b18","repo":"RocketChat/Rocket.Chat","slug":"invalid-triggerid-5bc270","errorCode":null,"errorMessage":"invalid triggerId","messagePattern":"invalid triggerId","errorType":"exception","errorClass":"Error","httpStatus":500,"severity":"error","filePath":"apps/meteor/server/modules/core-apps/cloudSubscriptionCommunication.module.ts","lineNumber":24,"sourceCode":"export class CloudSubscriptionCommunication extends CloudAnnouncementsModule {\n\toverride appId = 'cloud-communication-core';\n\n\toverride async viewClosed(payload: UiKitCoreAppViewClosedPayload): Promise<UiKit.ServerInteraction> {\n\t\tconst {\n\t\t\tpayload: { view: { viewId } = {} },\n\t\t\tuser: { _id: userId } = {},\n\t\t} = payload;\n\n\t\tif (!userId) {\n\t\t\tthrow new Error('invalid user');\n\t\t}\n\n\t\tif (!viewId) {\n\t\t\tthrow new Error('invalid view');\n\t\t}\n\n\t\tif (!payload.triggerId) {\n\t\t\tthrow new Error('invalid triggerId');\n\t\t}\n\n\t\t// for viewClosed we just need to let Cloud know that the banner was closed, no need to wait for the response\n\n\t\tvoid this.handlePayload(payload);\n\n\t\treturn {\n\t\t\ttype: 'modal.close',\n\t\t\ttriggerId: payload.triggerId,\n\t\t\tappId: payload.appId,\n\t\t};\n\t}\n}\n","sourceCodeStart":6,"sourceCodeEnd":38,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/modules/core-apps/cloudSubscriptionCommunication.module.ts#L6-L38","documentation":"`CloudSubscriptionCommunication.viewClosed` throws `Error('invalid triggerId')` when `payload.triggerId` is falsy. The triggerId addresses the `modal.close` response back to the client surface and is forwarded to Cloud, so a close without it is rejected before `handlePayload` runs.","triggerScenarios":"Closing a cloud communication modal through a viewClosed interaction that lacks `triggerId` — manually built payloads, replayed events, or clients that do not propagate the trigger.","commonSituations":"Custom automation mimicking modal close; tests omitting trigger metadata; middleware stripping fields.","solutions":["Forward the `triggerId` from the surface that opened the modal in the close payload.","If no response surface exists, use the underlying service call directly instead of the UiKit module."],"exampleFix":"// before\nawait cloudCommunicationModule.viewClosed({ appId: 'cloud-communication-core', user: { _id: userId }, payload: { view: { viewId } } } as any);\n\n// after\nawait cloudCommunicationModule.viewClosed({ appId: 'cloud-communication-core', user: { _id: userId }, payload: { view: { viewId } }, triggerId } as any);","handlingStrategy":"validation","validationCode":"if (!payload.triggerId) {\n  throw new Error('triggerId is required to close cloud communication modals');\n}\nawait cloudCommunicationModule.viewClosed(payload);","typeGuard":"const hasCloseTrigger = (\n  payload: UiKitCoreAppViewClosedPayload,\n): payload is UiKitCoreAppViewClosedPayload & { triggerId: string } =>\n  typeof payload.triggerId === 'string' && payload.triggerId.length > 0;","tryCatchPattern":"try {\n  await cloudCommunicationModule.viewClosed(payload);\n} catch (error) {\n  if (error instanceof Error && error.message === 'invalid triggerId') {\n    // dismiss via the underlying service without a modal.close response\n  }\n}","preventionTips":["Forward triggerId from the surface that opened the modal","Use service calls directly when no client response is needed"],"tags":["uikit","cloud","subscription","triggerid","payload-validation"],"backgroundTag":"uikit-interaction-payload-invalid","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}