diff --git a/modules/authorization/src/controllers/index.controller.ts b/modules/authorization/src/controllers/index.controller.ts index 3608d95c2..9900e12b2 100644 --- a/modules/authorization/src/controllers/index.controller.ts +++ b/modules/authorization/src/controllers/index.controller.ts @@ -45,13 +45,15 @@ export class IndexController { { resourceType: resource }, ], }); - await QueueController.getInstance().addRelationIndexJob( - relations.map(r => ({ - subject: r.subject, - relation: r.relation, - object: r.resource, - })), - ); + if (relations.length > 0) { + await QueueController.getInstance().addRelationIndexJob( + relations.map(r => ({ + subject: r.subject, + relation: r.relation, + object: r.resource, + })), + ); + } } async createOrUpdateObject(subject: string, entity: string) {