deploy_feedback icon indicating copy to clipboard operation
deploy_feedback copied to clipboard

Download failed Error: Got error 508 (Loop Detected) while fetching https://xxxxnovel.deno.dev/covers/novel-key.jpg

Open waptik opened this issue 1 year ago • 0 comments

Hi. I'm building a telegram bot that's converting novels to epub using my own module. So i saved the covers locally inside a /static folder in my github project and serving them on request basic through oakjs.

When i test the bot locally, the epub file is being generated without any issue but i face some roadblock when i deploy the code base on deno deploy.

Here's the code for covers routing

.get("/covers/:key.jpg", maxAge30Days, async (ctx) => {
    const cover = `${ctx.params.key}.jpg`;

    await ctx.send({
      path: cover,
      root: `${Deno.cwd()}/static`,
      extensions: ["jpg"],
    });
  });

Here's a portion of the error from deno deploy logs

...
Warning (cover https://xxxxnovel.deno.dev/covers/novel-key.jpg): Download failed Error: Got error 508 (Loop Detected) while fetching https://xxxxnovel.deno.dev/covers/novel-key.jpg
    at fetchable (https://deno.land/x/[email protected]/util/fetchable.ts:16:19)
    at async EPub.makeCover (https://deno.land/x/[email protected]/epub.ts:149:30)
    at async EPub.render (https://deno.land/x/[email protected]/epub.ts:54:9)
    at async EPub.genEpub (https://deno.land/x/[email protected]/epub.ts:59:9)
    at async EventEmitter.<anonymous> (file:///src/grammy/handlers/callbackQuery.ts:70:38)
2022-09-10 15:14:38
Failed to fetch `https://xxxxnovel.deno.dev/covers/novel-key.jpg` 2 times. Retrying...
2022-09-10 15:14:38
Failed to fetch `https://xxxxnovel.deno.dev/covers/novel-key.jpg` 1 time. Retrying...
2022-09-10 15:14:38
Making cover...
2022-09-10 15:14:38
No images to download
...

Deployment id: qv2d5mx8qn6g

waptik avatar Sep 10 '22 15:09 waptik