RocketChat/Rocket.Chat · error

Not implemented.

Error message

Not implemented.

What it means

AppPersistenceBridge.update(id, data, upsert, appId) is a stub in the Meteor implementation: after the object-type guard it unconditionally throws 'Not implemented.'. Updating a persistence record by its raw document id is simply not supported by the server bridge — only association-based writes (createWithAssociations / updateByAssociations) are implemented.

Solutions

  1. Use updateByAssociations(associations, data, upsert) — it is implemented and upserts
  2. Always create records with createWithAssociations so you can update them later by the same associations
  3. Alternatively emulate update: read by id, remove, then re-create with associations
  4. Never persist state whose only handle is the create()-returned Mongo id

Example fix

// before
const id = await app.getPersistence().create(data);
await persistenceUpdateById(id, newData); // bridge throws Not implemented.
// after
const assoc = [ RocketChatAssociationRecord.MINE ];
await app.getPersistence().createWithAssociations(data, assoc);
await app.getPersistence().updateByAssociations(assoc, newData, true); // upsert supported
Defensive patterns

Strategy: fallback

Try / catch

try {
  await persistenceUpdateById(id, newData);
} catch (err) {
  if (err instanceof Error && err.message === 'Not implemented.') {
    // fall back to the supported association-based upsert
    await app.getPersistence().updateByAssociations(associations, newData, true);
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: Any app code path that ends in the bridge's update(): e.g. calling apps-engine persistence update-by-id helpers, or storing with create() and then trying to modify the record using the returned id.

Common situations: Developers assuming CRUD symmetry (create/read/update/delete by id); porting examples that predate the association-based API; refactoring away from associations to raw ids.

Related errors


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

Appendix: source

Thrown at apps/meteor/app/apps/server/bridges/persistence.ts:113

		const records = await this.orch.getPersistenceModel().find(query).toArray();

		if (!records?.length) {
			return undefined;
		}

		await this.orch.getPersistenceModel().remove(query);

		return Array.isArray(records) ? records.map((r) => r.data) : [];
	}

	protected async update(id: string, data: object, _upsert: boolean, appId: string): Promise<string> {
		this.orch.debugLog(`The App ${appId} is updating the record "${id}"`);

		if (typeof data !== 'object') {
			throw new Error('Attempted to store an invalid data type, it must be an object.');
		}

		throw new Error('Not implemented.');
	}

	protected async updateByAssociations(
		associations: Array<RocketChatAssociationRecord>,
		data: object,
		upsert = true,
		appId: string,
	): Promise<string> {
		this.orch.debugLog({ msg: `The App ${appId} is updating the record with association to data as follows:`, associations });

		if (typeof data !== 'object') {
			throw new Error('Attempted to store an invalid data type, it must be an object.');
		}

		const query = {
			appId,
			associations,
		};

View on GitHub (pinned to b2c16d5842)