Typescript to figma plugin message "WAS" working fine. But not now!


  1. I created a Figma plugin (the orange rectangle creation as per Figma documentation)
  2. When I send message from HTML to typescript, it is working fine.
  3. I wrote a message handler in HTML. So that when I send a message from typescript to HTML, I can process it. Trust me, it was working fine. But not now.

Example is here…

in typescript,
Figma.ui.postMessage({ type: ‘totalSelected’, totalItemsSelected: selection.length });

in HTML,
window.onmessage = async (event) => {
const message = event.data.pluginMessage;
const type = message.type;
log(“Message:”, type, message);
console.log(“POST RECEIVED…”,message.type)

It was working… I am not sure, what happened :frowning:

Hi @Nidhin_Kuttikkattu_Rajeevan, Thanks for reaching out! I completely understand how frustrating it can be when something suddenly stops working.

I’ve reached out to our team internally to see if we can assist with this issue. We’ll keep you updated once we have any new information.

If any of our community members have any insights or suggestions, please feel free to share them here!


Can you specify what the actual error message is? Also, can you put your plugin code into a Github gist so we can see what you’re trying to do?

Here’s an example: code.ts · GitHub

1 Like

To be honest I have a good news. I resolved the problem by going to Figma documentation, from there I got a github repository of Figma sample projects. There I found a PostMessage() example, I used that and it started working.

1 Like