RocketChat/Rocket.Chat · error · Meteor.Error

error-invalid-user

error-invalid-user

Error message

Invalid user

What it means

The deprecated cloud:checkRegisterStatus Meteor method requires an authenticated user; Meteor.userId() returned null. Since 9.0.0 the method is deprecated in favor of GET /v1/cloud.registrationStatus, which methodDeprecationLogger announces on each call.

Source

Thrown at apps/meteor/server/meteor-methods/platform/cloud.ts:48

		'cloud:connectWorkspace': (token: string) => boolean | Error;
		'cloud:getOAuthAuthorizationUrl': () => string;
		'cloud:finishOAuthAuthorization': (code: string, state: string) => boolean;
		'cloud:checkUserLoggedIn': () => boolean;
		'cloud:logout': () => Promise<boolean | string>;
	}
}

Meteor.methods<ServerMethods>({
	/**
	 * @deprecated this method is deprecated and will be removed soon.
	 * Prefer using cloud.registrationStatus rest api.
	 */
	async 'cloud:checkRegisterStatus'() {
		methodDeprecationLogger.method('cloud:checkRegisterStatus', '9.0.0', '/v1/cloud.registrationStatus');
		const uid = Meteor.userId();

		if (!uid) {
			throw new Meteor.Error('error-invalid-user', 'Invalid user', {
				method: 'cloud:checkRegisterStatus',
			});
		}

		if (!(await hasPermissionAsync(uid, 'manage-cloud'))) {
			throw new Meteor.Error('error-not-authorized', 'Not authorized', {
				method: 'cloud:checkRegisterStatus',
			});
		}

		return retrieveRegistrationStatus();
	},
	async 'cloud:getWorkspaceRegisterData'() {
		const uid = Meteor.userId();

		if (!uid) {
			throw new Meteor.Error('error-invalid-user', 'Invalid user', {
				method: 'cloud:getWorkspaceRegisterData',

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Migrate to GET /api/v1/cloud.registrationStatus with X-Auth-Token/X-User-Id headers
  2. Ensure the caller is authenticated before invoking; re-login on error-invalid-user
  3. Remove calls to the deprecated method as part of upgrade work

Example fix

// before
const status = await Meteor.callAsync('cloud:checkRegisterStatus');

// after
const res = await fetch('/api/v1/cloud.registrationStatus', {
  headers: { 'X-Auth-Token': token, 'X-User-Id': uid },
});
const status = await res.json();
Defensive patterns

Strategy: try-catch

Validate before calling

if (!Meteor.userId()) {
  await ensureLogin();
}
// preferred: switch to GET /v1/cloud.registrationStatus

Type guard

const isInvalidUserError = (e: unknown): e is Meteor.Error =>
  typeof e === 'object' && e !== null && (e as { error?: string }).error === 'error-invalid-user';

Try / catch

try {
  await Meteor.callAsync('cloud:checkRegisterStatus');
} catch (e) {
  if (isInvalidUserError(e)) {
    await reauthenticate();
    return cloudStatusViaRest(); // GET /v1/cloud.registrationStatus
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling 'cloud:checkRegisterStatus' without a logged-in DDP session; scripts or outdated clients still using the deprecated method after a 9.x upgrade.

Common situations: Workspaces upgraded to 9.x with legacy clients calling deprecated cloud methods; unauthenticated automation probing cloud status; calls issued before the login resume completes.

Related errors


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