createImageAsync not working

I’m getting a weird bug, i’m using createImageAsync within a widget (placed in Figma, not FigJam) and loading an external image. after browsing docs and changing the manifest to contain ‘allowDomains’… it still doesn’t work.

the weird part is looking at the console I can see the image loaded correctly.

in the code I’m using async/await within try/catch… but no error is thrown out.

any suggestions?

piece of the code below

Network tab in console

What exactly is the bug? I see that you are loading the image but not applying it to the node fill. Should be imageHash: img.hash.

1 Like

yep… the function is not returning even the promise…

in the console… the promise is being returned and an Image object with hash is being returned after the promise is fulfill

Sorry, but I can’t confirm this. I have tried pointing the URL to PNG, JPG, SVG and Data URI (Base64 PNG) files. This method returns an Image object for PNG, JPG URLs and Data URI. For SVG URL, the catch block is triggered and the “Image type is unsupported” error is displayed.

1 Like

not really a bug…

the problem was that the widget was not waiting for the async/await… it started working once I imported ‘waitForTask’ and converted by code block into a Promise.