marcomontalbano / figma-export

Export tool for Figma. You can easily and automatically export your Figma components and use them directly into your website.
https://figma-export.marcomontalbano.com
MIT License
259 stars 33 forks source link

AWS Export Errors #113

Closed amcolash closed 2 years ago

amcolash commented 2 years ago

Firstly, just want to say thank you so much for your work on this fantastic module! It has been awesome to be able to use the figma API so easily. My use case involves a very large icon library with many different variations and sizes (1000s of files).

Every so often, I get stack traces like this:

fetching components 2000/3953
fetching components 2001/3953
fetching components 2002/3953
fetching components 2003/3953
fetching components 2004/3953
fetching components 2005/3953
Error: while fetching svg "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx": getaddrinfo ENOTFOUND s3-us-west-2.amazonaws.com
    at /Users/amcolash/dev/figma-export/node_modules/@figma-export/core/dist/lib/utils.js:47:15
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

It seems like something on Figma's side breaks once in a while or aws throttles the downloads. This issue is a bit of a feature request and of an ask for help. If I do have time and you have pointers, I might be able to whip up a PR.

It would be useful for my case to set a "retry" value in the config to retry the download - say maybe once or twice for a file before it totally crashes the export halfway through. In a scenario where the download fails, wait a moment, then retry until a the failure count is too great or the download succeeds.

Unfortunately, this behavior is very spotty and not easy to reproduce.

Any help would be appreciated. Right now, I have my CI job set to retry on failure, but that incurs a lot of overhead instead of just retrying the download on this module side. Thanks!

marcomontalbano commented 2 years ago

Hi @amcolash, I'm glad to hear that you like my work! Adding retry feature has been on my roadmap for a while and, with your request, the time to add this has come. I'll let you know as soon as I add the retry feature to the core module.

marcomontalbano commented 2 years ago

Hi @amcolash, I just released v4.2.0. I implemented a retry mechanism. By default the value is set to 3, but is configurable. I tested on a Figma file with around 2k components and now I don't have any aws error. Let me know if this works in your project.

amcolash commented 2 years ago

Awesome, I will give it a try. Thank you so much! If I run into issues I will check with you.