diff --git a/apps/figgos/apps/backend/src/generation/generation.service.ts b/apps/figgos/apps/backend/src/generation/generation.service.ts index e78b2481f..b30ede2ce 100644 --- a/apps/figgos/apps/backend/src/generation/generation.service.ts +++ b/apps/figgos/apps/backend/src/generation/generation.service.ts @@ -207,9 +207,11 @@ export class GenerationService { } } - private async downloadAndConvertImage(imageUrl: string): Promise { - const res = await fetch(imageUrl); - if (!res.ok) throw new Error(`Failed to download image: ${res.status}`); + private async downloadAndConvertImage(imageKey: string): Promise { + const url = this.storageService.getPublicUrl(imageKey); + this.logger.log(`Downloading image: ${url}`); + const res = await fetch(url); + if (!res.ok) throw new Error(`Failed to download image: ${res.status} from ${url}`); const webpBuffer = Buffer.from(await res.arrayBuffer()); return sharp(webpBuffer).jpeg({ quality: 85 }).toBuffer(); }