{"record":{"id":"1824f6711f808790","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-user-1824f6","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/integrations/outgoing/updateOutgoingIntegration.ts","lineNumber":125,"sourceCode":"\t\t\t\t\t\t\t...(integration.scriptCompiled ? { scriptError: 1 as const } : { scriptCompiled: 1 as const }),\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t},\n\t\t{ returnDocument: 'after' },\n\t);\n\n\tif (updatedIntegration) {\n\t\tawait notifyOnIntegrationChanged(updatedIntegration);\n\t}\n\n\treturn updatedIntegration;\n};\n\nMeteor.methods<ServerMethods>({\n\tasync updateOutgoingIntegration(integrationId, _integration) {\n\t\tmethodDeprecationLogger.method('updateOutgoingIntegration', '9.0.0', '/v1/integrations.update');\n\t\tif (!this.userId) {\n\t\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', {\n\t\t\t\tmethod: 'updateOutgoingIntegration',\n\t\t\t});\n\t\t}\n\n\t\treturn updateOutgoingIntegration(this.userId, integrationId, _integration);\n\t},\n});\n","sourceCodeStart":107,"sourceCodeEnd":133,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/integrations/outgoing/updateOutgoingIntegration.ts#L107-L133","documentation":"The Meteor method wrapper for updateOutgoingIntegration throws error-invalid-user when this.userId is unset — the DDP call arrived over a connection without an authenticated user. The guard fires before any validation, so payload problems are never the cause of this specific code.","triggerScenarios":"Meteor.call('updateOutgoingIntegration', id, payload) while logged out or with an expired session that resumed without a bound user.","commonSituations":"Integrations admin page after session expiry; scripts calling DDP without login; test harnesses missing a user stub.","solutions":["Authenticate the client and retry","Use PUT /v1/integrations.update with X-Auth-Token/X-User-Id headers for programmatic updates","Handle the error by redirecting to login and re-submitting the form"],"exampleFix":"// before\nMeteor.call('updateOutgoingIntegration', id, payload);\n\n// after\nif (!Meteor.userId()) {\n  throw new Meteor.Error('error-invalid-user', 'Login required');\n}\nawait Meteor.callAsync('updateOutgoingIntegration', id, payload);","handlingStrategy":"validation","validationCode":"if (!Meteor.userId()) {\n  throw new Meteor.Error('error-invalid-user', 'Login required');\n}\nawait Meteor.callAsync('updateOutgoingIntegration', id, payload);","typeGuard":null,"tryCatchPattern":"try {\n  await Meteor.callAsync('updateOutgoingIntegration', id, payload);\n} catch (err) {\n  if (err instanceof Meteor.Error && err.error === 'error-invalid-user') {\n    // session lost: prompt re-login, then retry once\n    return;\n  }\n  throw err;\n}","preventionTips":["Authenticate before updating integrations","Use PUT /v1/integrations.update with token headers for scripts","This code only means 'no user on the connection' — payload issues throw different codes"],"tags":["authentication","integrations","meteor-methods"],"backgroundTag":"authentication-required","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"}