RocketChat/Rocket.Chat · error · Meteor.Error
not_authorized
not_authorized
Error message
Unauthorized
What it means
The replayOutgoingIntegration method wrapper throws not_authorized 'Unauthorized' when this.userId is unset — replaying a stored outgoing-integration history entry requires an authenticated DDP session. The wrapper then delegates to replayOutgoingIntegrationMethod with the resolved userId.
Source
Thrown at apps/meteor/server/meteor-methods/integrations/outgoing/replayOutgoingIntegration.ts:18
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { Meteor } from 'meteor/meteor';
import { methodDeprecationLogger } from '../../../lib/deprecationWarningLogger';
import { replayOutgoingIntegrationMethod } from '../../../lib/integrations/functions/clearIntegrationHistory';
declare module '@rocket.chat/ddp-client' {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
replayOutgoingIntegration(params: { integrationId: string; historyId: string }): Promise<boolean>;
}
}
Meteor.methods<ServerMethods>({
async replayOutgoingIntegration({ integrationId, historyId }) {
methodDeprecationLogger.method('replayOutgoingIntegration', '9.0.0', '/v1/integrations.replayOutgoing');
if (!this.userId) {
throw new Meteor.Error('not_authorized', 'Unauthorized', { method: 'replayOutgoingIntegration' });
}
await replayOutgoingIntegrationMethod(this.userId, { integrationId, historyId });
return true;
},
});
View on GitHub (pinned to b2c16d5842)
Solutions
- Log in and retry the replay
- Use POST /v1/integrations.replayOutgoing with X-Auth-Token/X-User-Id for scripted replays
- Verify the history entry exists (integration history UI or API) so a missing-record error is not masked by the auth failure
Example fix
// before
Meteor.call('replayOutgoingIntegration', { integrationId, historyId });
// after
if (!Meteor.userId()) {
throw new Meteor.Error('not_authorized', 'Login required');
}
await Meteor.callAsync('replayOutgoingIntegration', { integrationId, historyId }); Defensive patterns
Strategy: validation
Validate before calling
if (!Meteor.userId()) {
throw new Meteor.Error('not_authorized', 'Login required');
}
await Meteor.callAsync('replayOutgoingIntegration', { integrationId, historyId }); Try / catch
try {
await Meteor.callAsync('replayOutgoingIntegration', { integrationId, historyId });
} catch (err) {
if (err instanceof Meteor.Error && err.error === 'not_authorized') {
// re-authenticate, then retry once
return;
}
throw err;
} Prevention
- Authenticate before replaying history entries
- Use POST /v1/integrations.replayOutgoing for automation
- Keep history entry ids paired with their integration id to avoid follow-up not-found errors
When it happens
Trigger: Meteor.call('replayOutgoingIntegration', { integrationId, historyId }) while logged out or on a connection whose session expired.
Common situations: Long-open integration history pages where the resumed login carries no user; automation attempting webhook replays over DDP.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/6ad47e9b69b184fa.
Report an issue: GitHub.