Text Review Plug-in timeout


Is there an amount of time that the ‘textreview’ callback must return within? I notice that if I don’t return any result within 3 seconds, I receive the following error:

Error: Text review plugins must call on('textreview') upon running

The logic of my plugin is as follows:

figma.on('textreview', async ({ text }) => {
   // Send message to UI to instantiate a websocket that receives text review suggestions
   // Register figma.ui.onmessage handler to receive text suggestions and websocket status from UI
   // await for 'idle' response from websocket running within the UI
   // return suggestions

At first I thought the issue was my handler receiving messages but then realised I get the same message if I wait on the plugin callback message for longer than 3s.


1 Like

Hey @scanning

Did you figure this out? I’m running into the same issue now!

@James_Cash Not yet. I opened a support ticket with Figma yesterday but haven’t heard back yet. I’ll be sure to update this post when I do.

Hi @scanning, I work on the Plugin API at figma and I can confirm that our current timeout is 3s as you’ve discovered :sweat_smile:

Thanks for flagging this - we’ll update the documentation to reflect this to avoid future confusion.

Relatedly, I’m curious if you have a use case that requires more than 3s to respond here?

@Michael_Yong I’m sending text for checking via a websocket connection. That takes time to establish and then depending on the length of the text, various suggestions will come back and fire a callback. The number of suggestions is non-deterministic and I have to wait for a timeout period for the websocket to become idle before I can definitively return suggestions or not.

1 Like

Quick update: We’re going to change this so that we don’t timeout if the callback takes longer than 3s. The only requirement is that “Text review plugins must call on(‘textreview’) upon running”!

Thanks for flagging this!

Thanks for the update @Michael_Yong. Is there a specific release that removes the 3s requirement? Let me know because I’d like to test and get my plug-in working. Thanks!

@scanning this should be out now!