RocketChat/Rocket.Chat · error · CloudWorkspaceConnectionError

Invalid user data received from Rocket.Chat Cloud

Error message

Invalid user data received from Rocket.Chat Cloud

What it means

`CloudAnnouncementsModule.getInteractant` decides who is interacting with a cloud announcement: a logged-in user (`payload.user`) or a livechat visitor (`payload.visitor`). If the payload identifies neither, it throws `CloudWorkspaceConnectionError('Invalid user data received from Rocket.Chat Cloud')`. Despite the message, this fires locally while transforming the interaction payload — the same error class is also used for genuine cloud connection failures (e.g. non-OK responses in `pushUserInteraction`), so check the message to distinguish them.

Source

Thrown at apps/meteor/server/modules/core-apps/cloudAnnouncements.module.ts:144

					username: payload.user.username,
					name: payload.user.name,
				},
			};
		}

		if ('visitor' in payload && payload.visitor) {
			return {
				visitor: {
					id: payload.visitor.id,
					username: payload.visitor.username,
					name: payload.visitor.name,
					department: payload.visitor.department,
					phone: payload.visitor.phone,
				},
			};
		}

		throw new CloudWorkspaceConnectionError(`Invalid user data received from Rocket.Chat Cloud`);
	}

	/**
	 * Transform the payload received from the Core App back to the format the UI sends from the client
	 */
	protected getInteraction(
		payload: UiKitCoreAppBlockActionPayload | UiKitCoreAppViewSubmitPayload | UiKitCoreAppViewClosedPayload,
	): UiKit.UserInteraction {
		if (payload.type === 'blockAction' && payload.container?.type === 'message') {
			const {
				actionId,
				payload: { blockId, value },
				message,
				room,
				triggerId,
			} = payload;

			if (!actionId || !blockId || !triggerId) {

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Attach `user: { _id, username, name }` (or the livechat `visitor` object) to the interaction payload before dispatching to the module.
  2. If the workspace uses an offline license, note `pushUserInteraction` also fails fast via `assertNotOfflineLicense()` — confirm the license state before debugging payloads.
  3. Catch `CloudWorkspaceConnectionError` at the call site and inspect `err.message`: 'Invalid user data...' means payload, 'Failed to connect...' means cloud reachability/token.

Example fix

// before
await module.blockAction({ appId: 'cloud-announcements-core', type: 'blockAction', actionId, payload: { blockId, value }, triggerId } as any);

// after
await module.blockAction({ appId: 'cloud-announcements-core', type: 'blockAction', user: { _id, username, name }, actionId, payload: { blockId, value }, triggerId } as any);
Defensive patterns

Strategy: try-catch

Validate before calling

const hasInteractant = (
  payload: UiKitCoreAppBlockActionPayload | UiKitCoreAppViewSubmitPayload | UiKitCoreAppViewClosedPayload,
): boolean => Boolean(payload.user || ('visitor' in payload && payload.visitor));

if (hasInteractant(payload)) {
  await module.blockAction(payload);
}

Type guard

function hasCloudInteractant(
  payload: UiKitCoreAppBlockActionPayload | UiKitCoreAppViewSubmitPayload | UiKitCoreAppViewClosedPayload,
): payload is (UiKitCoreAppBlockActionPayload | UiKitCoreAppViewSubmitPayload | UiKitCoreAppViewClosedPayload) & { user?: { _id: string }; visitor?: unknown } {
  return Boolean(payload.user || ('visitor' in payload && payload.visitor));
}

Try / catch

import { CloudWorkspaceConnectionError } from '../../lib/errors/CloudWorkspaceConnectionError';

try {
  await module.blockAction(payload);
} catch (error) {
  if (error instanceof CloudWorkspaceConnectionError && error.message.includes('Invalid user data')) {
    // payload lacks user/visitor: fix the payload, do not retry
  } else if (error instanceof CloudWorkspaceConnectionError) {
    // genuine cloud connectivity/token issue: check Cloud_Url, token, license
  }
}

Prevention

When it happens

Trigger: A `blockAction` or `viewSubmit` on `cloud-announcements-core` (or the fire-and-forget `viewClosed` forward) whose payload contains neither `user` nor `visitor` — e.g. anonymous interactions, synthetic payloads, or a payload shape change that dropped the interactant fields.

Common situations: Livechat visitors whose visitor object failed to propagate; custom dispatchers building core-app payloads by hand; version mismatches between client payload builders and the server module; misreading the message as a network problem when it is actually a payload problem.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/0a24c5191e6383c1. Report an issue: GitHub.