We were previously using a JavaScript query to store functions. However, it stopped working on its own and started throwing the following error:
jsLib: Failed to execute 'postMessage' on 'Window': function getAttribute() { return "attribute"; } could not be cloned.
With this being the function function getAttribute() { return "attribute"; }. This functionality was working as expected as at 29th of February, but started throwing the above error on the 4th of March.
The functions were invoked from various sections of the application, such as when displaying a label or when passing a payload to a resource query. It's important to note that the JavaScript query needs to be triggered before its functions are accessible. In this particular scenario, the JavaScript query is triggered on load, and that's when the error occurs.
@Abdul_Mumin I'm unable to reproduce the issue, can you share either screenshots of how this was set up, or an export of an app where you are seeing the error. Thanks!
Hey @Abdul_Mumin, heard back from the team that this functionality will not be added back into the product. Ultimately, allowing this was unintentional and can let our users do some dangerous things. We are working on some other ways of adding functions into Retool and I'll update you here as those get released.
Thanks again for reaching out about this -- I'm an engineer at Retool working on logic + code reusability, and I would love to learn more about your use cases. I also wanted to point you to a closed alpha we just launched for Sync Functions, which may be of interest to you. Please me know if you are open to chatting!
Best,
Erin
Update: The closed beta for resource functions and sync functions has concluded, and the feature is not being enabled for additional organizations. No further improvements or bug fixes will be made. See the Legacy: Resource and sync functions docs for details.
Thanks for getting back. I believe the Sync Functions could offer a solution to the challenges we're facing. I'm definitely interested in giving it a try. I appreciate you pointing me in that direction.
Yes, I'm open to chatting further about our use cases and how Sync Functions 3 might fit into our workflow.
To those who came across this topic, just a quick update. Earlier this year in March 2025, we launched App Functions Beta, which is the updated version of the Sync Functions Erin mentioned above.
App functions enable you to write reusable logic with dynamic parameters. Use functions when you want to perform the same actions on different pages, with different parameters, and return different data.
Update: The closed beta for resource functions and sync functions has concluded, and the feature is not being enabled for additional organizations. No further improvements or bug fixes will be made. See the Legacy: Resource and sync functions docs for details.