diff --git a/.changeset/twenty-camels-worry.md b/.changeset/twenty-camels-worry.md new file mode 100644 index 0000000000000..1ad93869c9144 --- /dev/null +++ b/.changeset/twenty-camels-worry.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': minor +--- + +Adds wrapExceptions to handle an unhandled promise rejection when adding and/or updating OAuth apps diff --git a/apps/meteor/server/services/meteor/service.ts b/apps/meteor/server/services/meteor/service.ts index 9cdb01169f793..a3653f2c36356 100644 --- a/apps/meteor/server/services/meteor/service.ts +++ b/apps/meteor/server/services/meteor/service.ts @@ -3,6 +3,7 @@ import { api, ServiceClassInternal } from '@rocket.chat/core-services'; import type { AutoUpdateRecord, IMeteor } from '@rocket.chat/core-services'; import type { ILivechatAgent, LoginServiceConfiguration, UserStatus } from '@rocket.chat/core-typings'; import { LoginServiceConfiguration as LoginServiceConfigurationModel, Users } from '@rocket.chat/models'; +import { wrapExceptions } from '@rocket.chat/tools'; import { Meteor } from 'meteor/meteor'; import { MongoInternals } from 'meteor/mongo'; @@ -146,14 +147,14 @@ export class MeteorService extends ServiceClassInternal implements IMeteor { this.onEvent('watch.loginServiceConfiguration', ({ clientAction, id, data }) => { if (clientAction === 'removed') { serviceConfigCallbacks.forEach((callbacks) => { - callbacks.removed?.(id); + wrapExceptions(() => callbacks.removed?.(id)).suppress(); }); return; } if (data) { serviceConfigCallbacks.forEach((callbacks) => { - callbacks[clientAction === 'inserted' ? 'added' : 'changed']?.(id, data); + wrapExceptions(() => callbacks[clientAction === 'inserted' ? 'added' : 'changed']?.(id, data)).suppress(); }); } });