{"record":{"id":"e22e13b328265ebb","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-user-e22e13","errorCode":"error-invalid-user","errorMessage":"Invalid user","messagePattern":"Invalid user","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/platform/cloud.ts","lineNumber":48,"sourceCode":"\t\t'cloud:connectWorkspace': (token: string) => boolean | Error;\n\t\t'cloud:getOAuthAuthorizationUrl': () => string;\n\t\t'cloud:finishOAuthAuthorization': (code: string, state: string) => boolean;\n\t\t'cloud:checkUserLoggedIn': () => boolean;\n\t\t'cloud:logout': () => Promise<boolean | string>;\n\t}\n}\n\nMeteor.methods<ServerMethods>({\n\t/**\n\t * @deprecated this method is deprecated and will be removed soon.\n\t * Prefer using cloud.registrationStatus rest api.\n\t */\n\tasync 'cloud:checkRegisterStatus'() {\n\t\tmethodDeprecationLogger.method('cloud:checkRegisterStatus', '9.0.0', '/v1/cloud.registrationStatus');\n\t\tconst uid = Meteor.userId();\n\n\t\tif (!uid) {\n\t\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', {\n\t\t\t\tmethod: 'cloud:checkRegisterStatus',\n\t\t\t});\n\t\t}\n\n\t\tif (!(await hasPermissionAsync(uid, 'manage-cloud'))) {\n\t\t\tthrow new Meteor.Error('error-not-authorized', 'Not authorized', {\n\t\t\t\tmethod: 'cloud:checkRegisterStatus',\n\t\t\t});\n\t\t}\n\n\t\treturn retrieveRegistrationStatus();\n\t},\n\tasync 'cloud:getWorkspaceRegisterData'() {\n\t\tconst uid = Meteor.userId();\n\n\t\tif (!uid) {\n\t\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', {\n\t\t\t\tmethod: 'cloud:getWorkspaceRegisterData',","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/platform/cloud.ts#L30-L66","documentation":"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.","triggerScenarios":"Calling 'cloud:checkRegisterStatus' without a logged-in DDP session; scripts or outdated clients still using the deprecated method after a 9.x upgrade.","commonSituations":"Workspaces upgraded to 9.x with legacy clients calling deprecated cloud methods; unauthenticated automation probing cloud status; calls issued before the login resume completes.","solutions":["Migrate to GET /api/v1/cloud.registrationStatus with X-Auth-Token/X-User-Id headers","Ensure the caller is authenticated before invoking; re-login on error-invalid-user","Remove calls to the deprecated method as part of upgrade work"],"exampleFix":"// before\nconst status = await Meteor.callAsync('cloud:checkRegisterStatus');\n\n// after\nconst res = await fetch('/api/v1/cloud.registrationStatus', {\n  headers: { 'X-Auth-Token': token, 'X-User-Id': uid },\n});\nconst status = await res.json();","handlingStrategy":"try-catch","validationCode":"if (!Meteor.userId()) {\n  await ensureLogin();\n}\n// preferred: switch to GET /v1/cloud.registrationStatus","typeGuard":"const isInvalidUserError = (e: unknown): e is Meteor.Error =>\n  typeof e === 'object' && e !== null && (e as { error?: string }).error === 'error-invalid-user';","tryCatchPattern":"try {\n  await Meteor.callAsync('cloud:checkRegisterStatus');\n} catch (e) {\n  if (isInvalidUserError(e)) {\n    await reauthenticate();\n    return cloudStatusViaRest(); // GET /v1/cloud.registrationStatus\n  }\n  throw e;\n}","preventionTips":["Migrate cloud DDP methods to their /v1 REST equivalents before the 9.x removal","Ensure an active session before reading cloud status","Cache cloud registration status to avoid repeated privileged calls"],"tags":["rocket-chat","meteor","authentication","cloud","deprecation"],"backgroundTag":"user-not-authenticated","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}