{"record":{"id":"49a1dc8e4984393a","repo":"RocketChat/Rocket.Chat","slug":"invalid-triggerid","errorCode":null,"errorMessage":"invalid triggerId","messagePattern":"invalid triggerId","errorType":"exception","errorClass":"Error","httpStatus":500,"severity":"error","filePath":"apps/meteor/server/modules/core-apps/banner.module.ts","lineNumber":24,"sourceCode":"\tappId = 'banner-core';\n\n\t// when banner view is closed we need to dismiss that banner for that user\n\tasync viewClosed(payload: UiKitCoreAppViewClosedPayload): Promise<UiKit.ServerInteraction> {\n\t\tconst {\n\t\t\tpayload: { view: { viewId: bannerId } = {} },\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 (!bannerId) {\n\t\t\tthrow new Error('invalid banner');\n\t\t}\n\n\t\tif (!payload.triggerId) {\n\t\t\tthrow new Error('invalid triggerId');\n\t\t}\n\n\t\tawait Banner.dismiss(userId, bannerId);\n\n\t\treturn {\n\t\t\ttype: 'banner.close',\n\t\t\ttriggerId: payload.triggerId,\n\t\t\tappId: payload.appId,\n\t\t\tviewId: bannerId,\n\t\t};\n\t}\n}\n","sourceCodeStart":6,"sourceCodeEnd":37,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/modules/core-apps/banner.module.ts#L6-L37","documentation":"`BannerModule.viewClosed` (`banner-core`) throws `Error('invalid triggerId')` when `payload.triggerId` is falsy. The triggerId routes the server interaction response (`banner.close`) back to the client surface that opened the banner, so without it the response has nowhere to go and the guard fires before `Banner.dismiss` runs.","triggerScenarios":"Dispatching a banner close interaction without a `triggerId` — e.g. synthetic interactions built by hand, payloads replayed from logs with the field stripped, or an old client version that does not forward the trigger.","commonSituations":"Programmatic dismissal attempts that mimic the UI payload incompletely; test harnesses that omit trigger metadata; middleware or serializers that drop falsy-looking fields.","solutions":["Forward the `triggerId` generated by the originating banner surface in the viewClosed payload.","If you only need server-side dismissal (no response surface), call `Banner.dismiss(userId, bannerId)` directly — no triggerId is required."],"exampleFix":"// before\nawait bannerModule.viewClosed({ appId: 'banner-core', user: { _id: userId }, payload: { view: { viewId } } } as any);\n\n// after\nawait bannerModule.viewClosed({ appId: 'banner-core', user: { _id: userId }, payload: { view: { viewId } }, triggerId } as any);","handlingStrategy":"validation","validationCode":"if (!payload.triggerId) {\n  throw new Error('triggerId is required for banner close interactions');\n}\nawait bannerModule.viewClosed(payload);","typeGuard":"const hasTriggerId = (\n  payload: UiKitCoreAppViewClosedPayload,\n): payload is UiKitCoreAppViewClosedPayload & { triggerId: string } =>\n  typeof payload.triggerId === 'string' && payload.triggerId.length > 0;","tryCatchPattern":"try {\n  await bannerModule.viewClosed(payload);\n} catch (error) {\n  if (error instanceof Error && error.message === 'invalid triggerId') {\n    // dismiss directly instead: await Banner.dismiss(userId, bannerId)\n  }\n}","preventionTips":["Forward the triggerId issued with the banner surface","For server-side dismissal with no UI, call Banner.dismiss directly","Do not strip trigger fields when logging or serializing payloads"],"tags":["uikit","banner","triggerid","payload-validation","core-apps"],"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-14T05:17:10.506Z"}