jemgold / figma-js

Little wrapper (+ types) for the Figma API
https://jongold.github.io/figma-js/
MIT License
490 stars 47 forks source link

Potential nesting limits; failed node render #33

Closed piperchester closed 4 years ago

piperchester commented 4 years ago

Heya figma-js team. I'm running into an issue with fetching a frame at a certain nested level. Debatable design file hygiene aside, I wanted to touch base with y'all to see if this behavior's been encountered.

From the "Copy link" menu in Figma, I grab the URL,

https://www.figma.com/file/hash/project?node-id=4316%3A10002

and then pass the node ID into the .fileImages call,

const figma = Figma.Client({
    personalAccessToken: FIGMA_TOKEN,
});

const response = await figma.fileImages(key, {
    // passing in the IDs from the above link
    ids: ['4316:10002'],
});

and get a response with,

// response.data
{
    err: null,
    images:
    {
        '4316:10002':  null  // instead of the expected S3 URL 
    }
}

Here's an image of the limits:

figma

Checking the docs, the closest hunch I have to what's happening is:

Important: the image map may contain values that are null. This indicates that rendering of that specific node has failed. This may be due to the node id not existing, or other reasons such has the node having no renderable components.

https://www.figma.com/developers/api#get-images-endpoint

So perhaps the Frame I'm copying doesn't have any renderable components? If that's the case, apologies for the ticket and my blatant misuse :-)

Love this project! Huge kudos to the authors and maintainers.

chrisdrackett commented 4 years ago

have you raised this with figma? This sounds like a bug/issue in their api and not this library (that just provides access to the API)

piperchester commented 4 years ago

have you raised this with figma? This sounds like a bug/issue in their api and not this library (that just provides access to the API)

Haven't but will surely do so, thanks!

piperchester commented 4 years ago

It looks like this is a limitation on the Figma API's render types -- only some types are supported (like "group"). Going to close out 👍