Skip to main content

I’m trying to make a basic plugin to edit the contents of a text node:

(async () => {
console.log("1");

const node = figma.currentPage.findOne((node) => {
return node.name == "TARGET_NODE";
});

if (node != null && node.type == "TEXT" && !node.hasMissingFont) {
console.log(node.characters);
await figma.loadFontAsync(node.fontName as FontName); // hangs here
console.log("3");
node.characters = "SUCCESS";
} else {
console.log("4");
}
})();

The code runs fine and finds the right node, but it hangs indefinitely when I try to load the font with the error “there are still font loads in progress. Please ensure closePlugin is not called until after the font loading has resolved.”. I’ve tried multiple fonts including basics like Times New Roman, but it can never seem to successfully load the font.

I saw a similar question  posted a couple years ago but it didn’t get any traction: 

I’m definitely not a typescript expert, am I missing a step somewhere?

Update, it seems like most if not all of the “load” functions are hanging for me. Also tried figma.loadAllPagesAsync() and saw similar issues even after waiting ~5 minutes with only a couple pages.


I had a figma.closePlugin() call outside of the async block 💀


Reply