RocketChat/Rocket.Chat · error · Meteor.Error

error-invalid-user

error-invalid-user

Error message

Invalid user

What it means

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.

Source

Thrown at apps/meteor/server/meteor-methods/integrations/outgoing/updateOutgoingIntegration.ts:125

							...(integration.scriptCompiled ? { scriptError: 1 as const } : { scriptCompiled: 1 as const }),
						},
					}),
		},
		{ returnDocument: 'after' },
	);

	if (updatedIntegration) {
		await notifyOnIntegrationChanged(updatedIntegration);
	}

	return updatedIntegration;
};

Meteor.methods<ServerMethods>({
	async updateOutgoingIntegration(integrationId, _integration) {
		methodDeprecationLogger.method('updateOutgoingIntegration', '9.0.0', '/v1/integrations.update');
		if (!this.userId) {
			throw new Meteor.Error('error-invalid-user', 'Invalid user', {
				method: 'updateOutgoingIntegration',
			});
		}

		return updateOutgoingIntegration(this.userId, integrationId, _integration);
	},
});

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Authenticate the client and retry
  2. Use PUT /v1/integrations.update with X-Auth-Token/X-User-Id headers for programmatic updates
  3. Handle the error by redirecting to login and re-submitting the form

Example fix

// before
Meteor.call('updateOutgoingIntegration', id, payload);

// after
if (!Meteor.userId()) {
  throw new Meteor.Error('error-invalid-user', 'Login required');
}
await Meteor.callAsync('updateOutgoingIntegration', id, payload);
Defensive patterns

Strategy: validation

Validate before calling

if (!Meteor.userId()) {
  throw new Meteor.Error('error-invalid-user', 'Login required');
}
await Meteor.callAsync('updateOutgoingIntegration', id, payload);

Try / catch

try {
  await Meteor.callAsync('updateOutgoingIntegration', id, payload);
} catch (err) {
  if (err instanceof Meteor.Error && err.error === 'error-invalid-user') {
    // session lost: prompt re-login, then retry once
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: Meteor.call('updateOutgoingIntegration', id, payload) while logged out or with an expired session that resumed without a bound user.

Common situations: Integrations admin page after session expiry; scripts calling DDP without login; test harnesses missing a user stub.

Understand the failure class

Background: error-invalid-user: "Invalid user" errors in Rocket.Chat — what they mean and how to fix them — this error's family across 2 libraries.

Related errors


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