iodigital-com / figex

2 stars 0 forks source link

Reference to external variables #1

Open mordekay-git opened 1 month ago

mordekay-git commented 1 month ago

Hello,

I tried to use your software today to export a Figma design, but did not manage to get the Figma nodes to load. I've tried a couple of Figma designs, and all return errors along the lines of:

tware/bin/figex-1.0.9281774456$ ./figex -c bostadstod_test1/bostadsstod_config.json 
💚 | 10:47:57 AM | FigEx            | Using cache at /home/mats/.figex
💚 | 10:47:58 AM | FigEx            | Loading Figma file:       
💚 | 10:47:58 AM | FigEx            |   Key: PnQQAjOwMoPWRpyIB1DL66
💚 | 10:48:00 AM | FigEx            |   Last modified: 2024-06-24T08:43:19Z
💚 | 10:48:00 AM | FigEx            |   Name: TestFile          
💚 | 10:48:00 AM | FigEx            |                           
❤️ | 10:48:01 AM | HTTP             | <== https://api.figma.com/v1/files/PnQQAjOwMoPWRpyIB1DL66/nodes?ids=4%3A572%2C4%3A573%2C10%3A310%2C10%3A311%2C10%3A312%2C2%3A1442%2C2%3A1438%2C2%3A1439%2C2%3A1447%2C2%3A1440%2C2091%3A199%2C2045%3A268%2C2042%3A949%2C2%3A1444%2C2%3A1437%2C2%3A1443%2C2%3A1458%2C2%3A1474%2C2%3A1451%2C2%3A1450%2C2%3A1448%2C2%3A1454%2C2%3A1445%2C2%3A1455%2C2132%3A1126: Canceled
❤️ | 10:48:01 AM | HTTP             | <== https://api.figma.com/v1/files/PnQQAjOwMoPWRpyIB1DL66/nodes?ids=2%3A1142%2C2%3A17%2C2%3A1410%2C2%3A2206: Canceled
❤️ | 10:48:02 AM | Main             | Uncaught exception         
                                                                io.ktor.client.plugins.ClientRequestException: Client request(GET https://api.figma.com/v1/files/PnQQAjOwMoPWRpyIB1DL66/nodes?ids=4%3A570%2C4%3A569%2C4%3A568%2C2%3A3204%2C2%3A3205%2C10%3A314%2C10%3A308%2C64ed51c0a6dcda88890e8a795240d3b1455df4e2%2F4002%3A0%2C4%3A574%2C5d77052fc3f9f1ef21716be86bff49ae4cb74122%2F21%3A2%2C39f1c686b4dfead83e06c6a03a2bd627de484979%2F10%3A18%2C140b6f0c5f3e865960a2c66a55b86ca8e78d5f13%2F13%3A29%2C1a2ea06525130cf9b858b453b44ce36f72b927ac%2F43%3A7%2C13%3A489%2Ca40d0581583dad7c6192c2663781c715ab41cd75%2F4%3A1%2C97da079d21086b6e8e1588fbc6f63910989789d3%2F4002%3A3) invalid: 400 . Text: "{"status":400,"err":"ID 64ed51c0a6dcda88890e8a795240d3b1455df4e2/4002:0 is not a valid node_id"}"
        at io.ktor.client.plugins.DefaultResponseValidationKt$addDefaultResponseValidation$1$1.invokeSuspend(DefaultResponseValidation.kt:54)
        at io.ktor.client.plugins.DefaultResponseValidationKt$addDefaultResponseValidation$1$1.invoke(DefaultResponseValidation.kt)
        at io.ktor.client.plugins.DefaultResponseValidationKt$addDefaultResponseValidation$1$1.invoke(DefaultResponseValidation.kt)
        at io.ktor.client.plugins.HttpCallValidator.validateResponse(HttpCallValidator.kt:51)
        at io.ktor.client.plugins.HttpCallValidator.access$validateResponse(HttpCallValidator.kt:43)
        at io.ktor.client.plugins.HttpCallValidator$Companion$install$3.invokeSuspend(HttpCallValidator.kt:152)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:100)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

Then I tried using my IDE integrated plugin to try and load the designs, which also stopped working today! So I took a look at the log files of my IDE, and it looks like the Figma Design API has been altered.

I don't have the exact details on what changed, and unfortunatly do not have the time to look into your source code to try and fix it myself.

If anyone else is also experiencing this issue, would be a great confirmation.

If I find time to dive deeper into this, I will. In the meantime, if you'd know what is wrong, would be awesome if you could let me know :)

If you need more information, log files etc, feel free to ask.

Kind regards.

crysxd commented 1 month ago

The export on my end still works as expected. Most likely there is just something different with your design files than with ours and the tool doesn't handle that well.

The ID 64ed51c0a6dcda88890e8a795240d3b1455df4e2/4002:0 looks weird, usually it's only the 4002:0 part. Do you maybe link to a different Figma file?

Would you be able to give me access to a minimal sample project with the issue? Then I can look into it

mordekay-git commented 1 month ago

Hmm, okay. Strange.

Might be that I am using the tool wrong (first time using Figma as well, so I'm not to familiar with how the API works). Do I maybe need to tag/name elements a certain way? Or use a specific type of element?

I've tried to create a reproducible test file, but it seems like I get a different error this time, and the node ID's it tries to fetch, seems to be even more 'incomplete'.

Here is the output from Figex: 💚 | 10:21:45 AM | FigEx | Using cache at /home/mats/.figex 💚 | 10:21:45 AM | FigEx | Key: 2vyv8EHtKdmkyJ4l18vD1F 💚 | 10:21:45 AM | FigEx | Loading Figma file: 💚 | 10:21:47 AM | FigEx | Name: ReproducibleTestFile 💚 | 10:21:47 AM | FigEx | Last modified: 2024-06-25T08:21:46Z 💚 | 10:21:47 AM | FigEx | ❤️ | 10:21:48 AM | HTTP | <== https://api.figma.com/v1/files/2vyv8EHtKdmkyJ4l18vD1F/nodes?ids=1%3A8%2C1%3A9%2C1%3A10%2C1%3A11%2C1%3A12%2C1%3A13%2C1%3A14: Canceled ❤️ | 10:21:48 AM | HTTP | <== https://api.figma.com/v1/files/2vyv8EHtKdmkyJ4l18vD1F/nodes?ids=: Canceled ❤️ | 10:21:49 AM | Main | Uncaught exception

When trying to export this minimal project Figma design file: https://www.figma.com/design/2vyv8EHtKdmkyJ4l18vD1F/ReproducibleTestFile?node-id=0-1&t=9f3JLmcDERIc94TT-1

I'll try and find out why the error is different/smaller than my other design file. Unfortunately I won't be able to share that, since it has sensitive customer information.

Thanks for looking into it!

I'll hear from you if you need any more information.

crysxd commented 1 month ago

Just looked into both issues.

"ReproducibleTestFile" issue

The issue with the ReproducibleTestFile is solved. There was no check for an empty ID list, the file doesn't contain components. After this is fixed, the same issue as originally reported is shown.....so success? I pushed a new version just now

Original issue

The original issue is still not clear to me, basically the variable id format is not what the tool expects. Our variable IDs are in the format 0000:00, but yours are xxxxxxxxxxxxxxxxxx/0000:00. I did not find anything regarding this in the Figma documentation, but to me it looks like you are referencing something external to the document itself.

One of the offending variable references is background as shown in the screenshot below. Do you know where this is linking to? Is this variable published from a different file? Could e.g 42cf59fa800c5d98f5dc4ba5d5e065ecde3ce7ee be a file ID?

Screenshot 2024-06-26 at 13 34 29

I did improve the error message, the "ReproducibleTestFile" now fails with:

java.lang.UnsupportedOperationException: References to external libraries are not supported at the moment, see https://github.com/iodigital-com/figex/issues/1
Affected variable: Document -> Page 1 -> ConfirmationPage -> Rectangle 22847 -> VariableID:b2af77ae8fb2124cf64534726a5a9c0543761546/43:7
mordekay-git commented 1 month ago

Ah yes, indeed. It seems to be referencing colors from other files. I did not know about this Figma function. Thanks for the update, the errors message helps a lot!

Great tool, thanks for the swift responses!

Have a great day.

crysxd commented 1 month ago

I will see if the tool can load those colors, but I fear the "Enterprise API" is needed for that, but I do not have access to this API

mordekay-git commented 1 month ago

No worries or haste.

The understanding of the linked variables for me, is enough :) Simply copying the project, and un-linking the variables does the trick (for my use case).

Cheers!

crysxd commented 1 month ago

I'll keep this open for now :) I might be able to do it via the teams endpoint