Front-End Software Engineer | Toolmaker & Infrastructure Developer
Wanna chat or talk about new projects?
Twitter | LinkedIn | Email | Discord
FigmaBackup is a Node.js CLI to backup Figma files and store them as local .fig files.
License: MIT License
Here are two errors I came across that appear when script crashes downloading big files.
Possible solution would be reloading the page if it loads for more than x seconds, because sometimes even when I'm trying to open Figma's web page with a big file in it, it won't load and I need to reload it manually.
> Backing up the file(VTB → Design Guidelines 2.0 (Copy))...
. Setting the download behavior...
> Saving a local copy of the file(VTB → Design Guidelines 2.0 (Copy))...
. Opening up the figma command palette...
. Typing down the download command...
> Stopping the bot...
figma-backup --figma-email "<YOUR_EMAIL>" --figma-password "<YOUR_PASSWORD>"
--figma-token "<YOUR_TOKEN>" --projects-ids "ID1" "ID2" ...
Options:
--help Show help [boolean]
--version Show version number [boolean]
-e, --figma-email Figma user's email. [string] [required]
-p, --figma-password Figma user's password. [string] [required]
-t, --figma-token Figma access token. [string] [required]
--projects-ids Figma projects ids. [array] [required]
--debug Opt-in `debug` argument if you want to let the bot to
open a local chromium window on your client.
[boolean] [default: false]
--download-timeout This number indicates the maximum amount of time the
bot has to wait for a file to be downloaded. (in
minutes). [number] [default: 5]
--interaction-delay This number indicates the delay between interactions.
(in seconds). [number] [default: 2]
--typing-delay This number indicates the delay to type a new
character. (in miliseconds). [number] [default: 100]
BackupError: Backup failed | Protocol error (Input.dispatchKeyEvent): Session closed. Most likely the page has been closed.
at Bot._backupProjects (/usr/local/lib/node_modules/figma-backup/lib/Bot.js:144:19)
at async Bot.start (/usr/local/lib/node_modules/figma-backup/lib/Bot.js:166:9)
at async Object.handler (/usr/local/lib/node_modules/figma-backup/lib/index.js:75:5) {
_error: Error: Protocol error (Input.dispatchKeyEvent): Session closed. Most likely the page has been closed.
at CDPSession.send (/usr/local/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:285:35)
at Keyboard.down (/usr/local/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/common/Input.js:119:67)
at Keyboard.press (/usr/local/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/common/Input.js:235:20)
at Keyboard.type (/usr/local/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/common/Input.js:201:28)
at saveLocalCopy (/usr/local/lib/node_modules/figma-backup/lib/utils/saveLocalCopy.js:30:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Bot._backupFile (/usr/local/lib/node_modules/figma-backup/lib/Bot.js:113:9)
at async Bot._backupProject (/usr/local/lib/node_modules/figma-backup/lib/Bot.js:130:13)
at async Bot._backupProjects (/usr/local/lib/node_modules/figma-backup/lib/Bot.js:140:17)
at async Bot.start (/usr/local/lib/node_modules/figma-backup/lib/Bot.js:166:9)
}
> Backing up the file(00.KP (Components&Guide) (old))...
◟ . Waiting for the page to be loaded...> Stopping the bot...
◜ . Waiting for the page to be loaded...figma-backup --figma-email "<YOUR_EMAIL>" --figma-password "<YOUR_PASSWORD>"
--figma-token "<YOUR_TOKEN>" --projects-ids "ID1" "ID2" ...
Options:
--help Show help [boolean]
--version Show version number [boolean]
-e, --figma-email Figma user's email. [string] [required]
-p, --figma-password Figma user's password. [string] [required]
-t, --figma-token Figma access token. [string] [required]
--projects-ids Figma projects ids. [array] [required]
--debug Opt-in `debug` argument if you want to let the bot to
open a local chromium window on your client.
[boolean] [default: false]
--download-timeout This number indicates the maximum amount of time the
bot has to wait for a file to be downloaded. (in
minutes). [number] [default: 5]
--interaction-delay This number indicates the delay between interactions.
(in seconds). [number] [default: 2]
--typing-delay This number indicates the delay to type a new
character. (in miliseconds). [number] [default: 100]
BackupError: Backup failed | waiting for function failed: timeout 30000ms exceeded
at Bot._backupProjects (/usr/local/lib/node_modules/figma-backup/lib/Bot.js:144:19)
at async Bot.start (/usr/local/lib/node_modules/figma-backup/lib/Bot.js:166:9)
at async Object.handler (/usr/local/lib/node_modules/figma-backup/lib/index.js:75:5) {
_error: TimeoutError: waiting for function failed: timeout 30000ms exceeded
at new WaitTask (/usr/local/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/common/IsolatedWorld.js:445:34)
at IsolatedWorld.waitForFunction (/usr/local/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/common/IsolatedWorld.js:349:26)
at Frame.waitForFunction (/usr/local/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/common/Frame.js:479:59)
at Page.waitForFunction (/usr/local/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2446:33)
at Bot._backupFile (/usr/local/lib/node_modules/figma-backup/lib/Bot.js:101:20)
at async Bot._backupProject (/usr/local/lib/node_modules/figma-backup/lib/Bot.js:130:13)
at async Bot._backupProjects (/usr/local/lib/node_modules/figma-backup/lib/Bot.js:140:17)
at async Bot.start (/usr/local/lib/node_modules/figma-backup/lib/Bot.js:166:9)
at async Object.handler (/usr/local/lib/node_modules/figma-backup/lib/index.js:75:5)
}
i logged in with google in Figma and i don't have any password to enter in backup process what should i do when interface want a password from me?
Recently an error appeared when downloading a file. In this case, the authorization is successful, it moves to the file successfully, and it is at the input of the context menu where we enter the command “save local copy” that the error appears. At the same time, manual backup using Figma works successfully.
We tried to roll back six months and start using a different account. Does not help.
Help me please.
We got the following with executing figma-backup
:
> Starting the backup task...
> Authenticating the bot...
. Bot successfully logged in.
. Caching the cookies...
. Looking for cached cookies...
. Restoring the cached cookies...
> Backuping the file(project)...
. Setting the download behaviour...
. Saving a local copy of the file(project)...
. Opening up the figma command pallete...
. Typing down the download command...
. Execute the download command...
ERR. Download aborted | Timeout of 300s exceeded.
Should something be changed?
I get timed out even though it's downloaded all files and I can open them on figma.
/ ___|_ _|/ \ | _ \_ _|
\___ \ | | / _ \ | |_) || |
___) || |/ ___ \| _ < | |
|____/ |_/_/ \_\_| \_\|_|
Starting the backup task...
> Authenticating the bot...
. Bot successfully logged in.
. Caching the cookies...
. Looking for cached cookies...
. Restoring the cached cookies...
(node:278030) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
> Backuping the file(2)...
. Setting the download behaviour...
> Saving a local copy of the file(2)...
. Opening up the figma command palette...
. Typing down the download command...
. Execute the download command...
ERR. Download aborted | Timeout of 60s exceeded.
> Backuping the file(Untitled)...
. Setting the download behaviour...
> Saving a local copy of the file(Untitled)...
. Opening up the figma command palette...
. Typing down the download command...
. Execute the download command...
ERR. Download aborted | Timeout of 60s exceeded.
Backup task finished! (time elapsed: 217s)
> Stopping the bot...```
Figma's API can show if a file was modified or not https://www.figma.com/developers/api#get-files-endpoint , based on that it would be very convenient if the script could download a file only if it was modified.
It also shows when a certain project was modified https://www.figma.com/developers/api#get-project-files-endpoint , but it works really weird because if I modify a file in a project, for some reason, it's not showing that the project was modified, so be ware of that, I already made a ticket about this problem, I hope they fix it.
Thanks.
C:\Users\admin\AppData\Roaming\npm\node_modules\figma-backup\lib\Bot.js:149
const isRootUser = process.getuid() === 0;
^
TypeError: process.getuid is not a function
at Bot.start (C:\Users\admin\AppData\Roaming\npm\node_modules\figma-backup\lib\Bot.js:149:36)
at startBot (C:\Users\admin\AppData\Roaming\npm\node_modules\figma-backup\lib\index.interactive.js:100:8)
at run (C:\Users\admin\AppData\Roaming\npm\node_modules\figma-backup\lib\index.interactive.js:104:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
using this commands
npm install -g figma-backup
npm update -g figma-backup
trying with yarn also.
node modules folder also created .
any idea??
Hey guys!
Installed the figma-backup, ran it and got a request failed with status code 404. Tried to look through the issues here, but found nothing related with that one. Also, used --debug. It opens, authorizes successfully and then just closes with no result. Could help me with that? Any ideas where I should dig in to?
Thanks! Appreciate your work and assistance on the issue!
Starting the backup task...
Authenticating the bot...
. Bot successfully logged in.
. Caching the cookies...
. Looking for cached cookies...
. Setting the cached cookies...
◡ > Fetching the project(Archive) files...ERR. Backup failed | Request failed with status code 404
Stopping the bot...
◠ > Fetching the project(Archive) files...
Great project!
What I'm missing is a possibility to export files additionally in a different format, because if Figma goes down .fig files are of no use. So an additional export as Sketch, XD, PDF, or PNG files would be nice!
Hello Dear Mostafa
I tried your code to back up our projects in figma.
After starting and logging in to figma, It showed the bot downloading files and showed me a green message.
But when it's done, in figma-root-backup dir, I couldn't find files. I have 14 files in our figma space but the bot just backup 5 files.
Could you help me in this case, please?
If you need more details, just let me know.
Thanks
Hi, thanks for your great work.
I get this error and I don't know why it happens. any idea?
sudo figma-backup -e "EMAIL" -p "PASSWORD" -t "TOKEN" --projects-ids "ID" --download-timeout 45
> Starting the backup task...
> Authenticating the bot...
. Bot successfully logged in.
. Caching the cookies...
. Looking for cached cookies...
. Restoring the cached cookies...
> Backuping the file(Project Name)...
. Setting the download behaviour...
. Saving a local copy of the file(Project Name)...
. Opening up the figma command pallete...
. Typing down the download command...
. Execute the download command...
ERR. Download aborted | Timeout of 2700s exceeded.
Backup task finished! (time elapsed: 2797s)
i am using this command
figma-backup -e [email protected] -p 'myPassword' -t 'mySecretKey' --projects-ids 9FOKHeV9u6VwWYkPkX2WZA
with project id that i toke from this url
https://www.figma.com/file/9FOKHeV9u6VwWYkPkX2WZA/Su-Ui-process-(Copy)?node-id=81%3Ad40
Starting the backup task...
Authenticating the bot...
. Bot successfully logged in.
. Caching the cookies...
. Looking for cached cookies...
. Restoring the cached cookies...
/ > Fetching the project(9FOKHeV9u6VwWYkPkX2WZA) files...> Stopping the bot...
this is the proccec and this is the error i give
BackupError: Backup failed | Request failed with status code 403
in my experience i used a vpn that open the android studio site in this case my vpn shouldn't have any problem with sanctions
دلیل اینکه میخاد کرومیوم رو دانلود کنه چیه؟
موقع نصب میره برای دانلود کرومیوم.
Good day.
I started using your tool and every time I start figma-backup-interactive
I get Unexpected Redirect error.
Probably, you need to handle the redirect in the code.
Traces:
? Enter the ids of your figma projects:
(Separate the ids with SPACE(s). i.e. ID1 ID2 ID3) XXXXX (I entered just one)
? Enter the download timeout (in minutes):
(This number indicates the maximum amount of time the bot has to wait for a file to be downloaded.) 5
? Enter the interaction delay (in seconds):
(This number indicates the delay between interactions.) 2
? Enter the typing delay (in miliseconds):
(This number indicates the delay to type a new character.) 100
Starting the backup task...
Authenticating the bot...
Stopping the bot...
/Users/username/.npm-global/lib/node_modules/figma-backup/lib/Bot.js:145
throw new errors_1.BackupError(e);
^
BackupError: Backup failed | Authorization failed | Unexpectedly redirected to "https://www.figma.com/files/ID/recent?fuid=FUID"
at Bot._backupProjects (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/Bot.js:145:19)
at async Bot.start (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/Bot.js:167:9)
at async startBot (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/index.interactive.js:94:5)
at async run (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/index.interactive.js:105:5) {
_error: AuthorizationError: Authorization failed | Unexpectedly redirected to "https://www.figma.com/files/ID/recent?fuid=FUID"
at Bot._login (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/Bot.js:66:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Bot._authenticate (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/Bot.js:71:9)
at async Bot._backupProjects (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/Bot.js:139:13)
at async Bot.start (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/Bot.js:167:9)
at async startBot (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/index.interactive.js:94:5)
at async run (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/index.interactive.js:105:5) {
_error: Error: Unexpectedly redirected to "https://www.figma.com/files/ID/recent?fuid=FUID"
at new AuthorizationError (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/errors/AuthorizationError.js:7:51)
at Bot._login (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/Bot.js:66:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Bot._authenticate (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/Bot.js:71:9)
at async Bot._backupProjects (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/Bot.js:139:13)
at async Bot.start (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/Bot.js:167:9)
at async startBot (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/index.interactive.js:94:5)
at async run (/Users/username/.npm-global/lib/node_modules/figma-backup/lib/index.interactive.js:105:5)
}
}
Mac OS 13.0.1, npm 8.11.0, figma-backup 2.0.0
First of all, I'm a newb designer just trying to get backups working so I may not fully understand my issue but I feel like this error is telling me I have a few more pre-reqs to install before this script works.
/ ___|_ _|/ \ | _ \_ _|
\___ \ | | / _ \ | |_) || |
___) || |/ ___ \| _ < | |
|____/ |_/_/ \_\_| \_\|_|
/usr/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:203
reject(new Error([
^
Error: Failed to launch the browser process!
/usr/lib/node_modules/figma-backup/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/usr/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:203:20)
at Interface.<anonymous> (/usr/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:68)
at Interface.emit (node:events:402:35)
at Interface.close (node:internal/readline/interface:496:10)
at Socket.onend (node:internal/readline/interface:229:10)
at Socket.emit (node:events:402:35)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Node.js v17.2.0
root@figma:~#
For context this is a fresh install of Ubuntu in a virtualized environment.
An example:
figma-backup
-e "[email protected]"
-p "secretpassword"
-t "secrettoken"
--teams-ids "ID1" "ID2"
Hi,
I have encountered an issue with this package while trying to back up a specific project. The package works fine with other projects, but with this one, I receive an error. The output is as follows:
Starting the backup task...
> Authenticating the bot...
. Bot successfully logged in.
. Caching the cookies...
. Looking for cached cookies...
. Setting the cached cookies...
> Backing up the file(UI Design - Handoff)...
. Setting the download behavior...
> Saving a local copy of the file(UI Design - Handoff)...
. Opening up the figma command palette...
. Typing down the download command...
ERR. Couldn't find the download command.
. Execute the download command...
ERR. Backup failed | Protocol error (Input.dispatchKeyEvent): Session closed. Most likely the page has been closed.
> Stopping the bot...
Hi!
Thank you for for very useful tool.
For now we have this directories layout for backup:
└── backups/
└── [ISOStringifiedDate]/
I have a suggestion - the ability to specify backup rotation rules (for example, keep the last 2 backups, and delete the older ones).
Or, for example, the ability to remove saving to a [ISOStringifiedDate] directory from backup path.
> Backing up the file(Personal account archive)...
. Setting the download behavior...
> Saving a local copy of the file(Personal account archive)...
. Opening up the figma command palette...
. Typing down the download command...
. Execute the download command...
. File (Personal account archive) successfully downloaded.
(You are seeing this message because the bot has detected network idleness and assumes the download has finished)
> Backing up the file(Reports.file)...
. Setting the download behavior...
> Saving a local copy of the file(Reports.file)...
. Opening up the figma command palette...
. Typing down the download command...
. Execute the download command...
. File (Reports.file) successfully downloaded.
(You are seeing this message because the bot has detected network idleness and assumes the download has finished)
> Backing up the file(Флоу)...
. Setting the download behavior...
> Saving a local copy of the file(Флоу)...
. Opening up the figma command palette...
ERR. Couldn't open the figma command palette.
. Typing down the download command...
ERR. Backup failed | Protocol error (Input.dispatchKeyEvent): Session closed. Most likely the page has been closed.
> Stopping the bot...
May cyrillic word "Флоу" be the issue for this error? This happens every time I run this script (via npm or via docker - it doesn't matter)
Hi, thanks for this package, this is tremendously helpful for our workflow!
Are you planning on bumping the NPM dependencies in the near future, though? Most dependencies are roughly a year old as of now and things like Axios and Puppeteer have released several major releases in the meantime.
Hello,
Thank you for developing this amazing package. I was wondering if it would be possible to add a feature that allows users to specify a download path for each project.
I am currently working on a small service that backs up all of my Figma projects, organizes them, and sends them to me via Telegram. However, the current folder structure splits the backups into multiple folders named with datetime, which makes it difficult to determine which backup belongs to which project.
Having the ability to specify a download path for each project would greatly enhance the organization and efficiency of my backup process.
Thank you in advance for your assistance.
Hi. Try on Ubuntu 22.04.
Node.js version: v20.2.0
I have some errors:
BackupError: Backup failed | Protocol error (Input.dispatchKeyEvent): Session closed. Most likely the page has been closed.
at Bot._backupProjects (/root/.nvm/versions/node/v20.2.0/lib/node_modules/figma-backup/lib/Bot.js:144:19)
at async Bot.start (/root/.nvm/versions/node/v20.2.0/lib/node_modules/figma-backup/lib/Bot.js:166:9)
at async Object.handler (/root/.nvm/versions/node/v20.2.0/lib/node_modules/figma-backup/lib/index.js:75:5) {
_error: Error: Protocol error (Input.dispatchKeyEvent): Session closed. Most likely the page has been closed.
at CDPSession.send (/root/.nvm/versions/node/v20.2.0/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:285:35)
at Keyboard.down (/root/.nvm/versions/node/v20.2.0/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/common/Input.js:119:67)
at Keyboard.press (/root/.nvm/versions/node/v20.2.0/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/common/Input.js:235:20)
at Keyboard.type (/root/.nvm/versions/node/v20.2.0/lib/node_modules/figma-backup/node_modules/puppeteer/lib/cjs/puppeteer/common/Input.js:201:28)
at saveLocalCopy (/root/.nvm/versions/node/v20.2.0/lib/node_modules/figma-backup/lib/utils/saveLocalCopy.js:30:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Bot._backupFile (/root/.nvm/versions/node/v20.2.0/lib/node_modules/figma-backup/lib/Bot.js:113:9)
at async Bot._backupProject (/root/.nvm/versions/node/v20.2.0/lib/node_modules/figma-backup/lib/Bot.js:130:13)
at async Bot._backupProjects (/root/.nvm/versions/node/v20.2.0/lib/node_modules/figma-backup/lib/Bot.js:140:17)
at async Bot.start (/root/.nvm/versions/node/v20.2.0/lib/node_modules/figma-backup/lib/Bot.js:166:9)
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.