diff --git a/packages/core/database/src/update-associations.ts b/packages/core/database/src/update-associations.ts index b1948d8d2..844b2dde0 100644 --- a/packages/core/database/src/update-associations.ts +++ b/packages/core/database/src/update-associations.ts @@ -6,7 +6,7 @@ import { HasOne, Hookable, ModelCtor, - Transactionable, + Transactionable } from 'sequelize'; import { Model } from './model'; import { UpdateGuard } from './update-guard'; @@ -443,6 +443,9 @@ export async function updateMultipleAssociation( const instance = await association.target.findByPk(item[pk], { transaction, }); + if (!instance) { + continue; + } const addAccessor = association.accessors.add; await model[addAccessor](item[pk], accessorOptions);