diff --git a/server/libs/domain/src/media/media.service.spec.ts b/server/libs/domain/src/media/media.service.spec.ts index bdb6b1eefd..81b55638f3 100644 --- a/server/libs/domain/src/media/media.service.spec.ts +++ b/server/libs/domain/src/media/media.service.spec.ts @@ -213,6 +213,10 @@ describe(MediaService.name, () => { }); describe('handleVideoConversion', () => { + beforeEach(() => { + assetMock.getByIds.mockResolvedValue([assetEntityStub.video]); + }); + it('should log an error', async () => { mediaMock.transcode.mockRejectedValue(new Error('unable to transcode')); diff --git a/server/libs/domain/src/media/media.service.ts b/server/libs/domain/src/media/media.service.ts index 5af30ef9ad..c32e8376ff 100644 --- a/server/libs/domain/src/media/media.service.ts +++ b/server/libs/domain/src/media/media.service.ts @@ -119,7 +119,11 @@ export class MediaService { } async handleVideoConversion(job: IAssetJob) { - const { asset } = job; + const [asset] = await this.assetRepository.getByIds([job.asset.id]); + + if (!asset) { + return; + } try { const input = asset.originalPath;