mikaelvesavuori / figmagic

Figmagic is the missing piece between DevOps and design: Generate design tokens, export graphics, and extract design token-driven React components from your Figma documents.
https://docs.figmagic.com
MIT License
808 stars 71 forks source link

Missing one or more of required arguments: "figmaToken", "figmaUrl" when attempting to get data from Figma API! #80

Closed manuschillerdev closed 3 years ago

manuschillerdev commented 3 years ago

Describe the bug I get an errormessage indicating that my token and figa url are not processes correctly

To Reproduce

  1. yarn global add figmagic
  2. duplicate https://www.figma.com/community/file/821094451476848226
  3. create new local folder with .env file:
    FIGMA_TOKEN=***
    FIGMA_URL=https://www.figma.com/file/bpckD3geTYg6cJGBBtt36L/Figmagic-%E2%80%94-Design-System-template-4.0-Community
  4. run figmagic in this folder

result

Attempting to fetch data from Figma API...
Error: Error: Error: Missing one or more of required arguments: "figmaToken", "figmaUrl" when attempting to get data from Figma API!

Expected behavior figmagic can connect to my design and extract the tokens

Desktop (please complete the following information):

I double checked the Token and the URL 👍

manuschillerdev commented 3 years ago

I got it. You need to pass in the ID of your File into the variable FIGMA_URL. It is described in the readme, but the name confused me. Maybe FIGMA_URL would better be called FIGMA_FILE_ID or something similar?

so in my case it was

- FIGMA_URL=https://www.figma.com/file/bpckD3geTYg6cJGBBtt36L/Figmagic-%E2%80%94-Design-System-template-4.0-Community
+ FIGMA_URL=bpckD3geTYg6cJGBBtt36L

leaving this open for feedback on the wording - but my actual problem is solved :)

mikaelvesavuori commented 3 years ago

Hey! Good you made it 👍

Agree on the wording, it has been something I have thought about more than once.

Will give it a poke and see if this is easily handled, in which case I will fix this in the next few days.

mikaelvesavuori commented 3 years ago

This issue is now fixed in 4.0.2.

Instead of renaming the variable and breaking a lot of users' setups, the URL is funneled through a function that checks whether the string looks like a full URL (beginning with https://www.figma.com/file/) or else just uses whatever comes in.

Thanks for raising. Happy to have improved this!