Strapi v5 error when trying to save or publish data after migration

System Information
  • Strapi Version: 5
  • Operating System: aws ebs
  • Database: postgressql
  • Node Version: 20

I have migrated my strapi project from v4 to v5 however when trying to save or publish data i am faced with this error

any explanation what does this error mean


after a bit of investigating the issue, here is the function throwing the error

const getRelationIds = fp.curry(
  (idMap, targetUid, source, relation) => {
    const targetLocale = i18n.getRelationTargetLocale(relation, {
      targetUid,
      sourceUid: source.uid,
      sourceLocale: source.locale
    });
    const targetStatus = dp.getRelationTargetStatus(relation, {
      targetUid,
      sourceUid: source.uid,
      sourceStatus: source.status
    });
    const ids = [];
    for (const tStatus of targetStatus) {
      const entryId = idMap.get({
        uid: targetUid,
        documentId: relation.documentId,
        locale: targetLocale,
        status: tStatus
      });
      if (entryId)
        ids.push(entryId);
    }
    if (!ids.length && !source.allowMissingId) {
      throw new strapiUtils.errors.ValidationError(
        `Document with id "${relation.documentId}", locale "${targetLocale}" not found`
      );
    }
    return ids;
  }
);

here is some logs I added
relation {
id: 1,
name: ‘Songs’,
pathId: 1,
path: ‘/1’,
createdAt: ‘2023-04-08T21:17:32.672Z’,
updatedAt: ‘2023-04-08T21:17:32.672Z’,
documentId: ‘zq5cjpsdov01x8t3jscqf64y’,
locale: ‘en’,
publishedAt: null
}

source { locale: undefined, status: ‘draft’, uid: ‘api::song.song’ }
targetUid plugin::upload.folder

For people facing the same issue Document with id not found, I have moved my media file from one folder to another and things started to work.

1 Like

This also helped me. If I move the image back to the original folder, the error occurs again. I don’t want to rename all my folders. Does anyone have any ideas?

What works: Create new temp folder, move all assets to new folder, delete old folder, create old folder with same name, move assets back, delete temp folder.

1 Like