I'm working on gracefully handling 429 errors when fetching Figma files in our app. To import a Figma layout, users provide an X-FIGMA-TOKEN. Recently, the rate limits have been updated, and we need to provide more detailed information about the current user's limit. However, the response I receive from the endpoint does not include any of the headers described in the developer documentation. The response only contains the status code and a message.
Am I missing something? How can I access the Retry-After, X-Figma-Rate-Limit-Type, and other headers described here: https://developers.figma.com/docs/rest-api/rate-limits/?
I use the fetch method the request looks something like this:
fetch(`https://api.figma.com/v1/files/${file}/nodes?ids=${node}&geometry=paths`, { headers: {'X-FIGMA-TOKEN': KEY, 'Content-Type': 'application/json'} })
This is the response I get: {status: 429, err: 'Rate limit exceeded'}
The response headers are empty.