Preloaded JavaScript functions doesn't work in the Cloud instance

We just finished migration from self-hosted Retool server to the Retool Cloud. Most modules and app migrated smoothly but for some reason all the Preloaded JS code is not available in any of the modules/app.

Checked it in both Global settings in the Advanced tab and inside the module > App Settings > Preloaded JS. None of them are seen by Retool components or JS Queries inside the module.

Functions presented as undefined in both straight name calls and when we try call them from the window object -window.xxx. Actually, Retool Cloud is not recognize window object at all. It says window is not defined.

Same code works perfectly in the self-hosted Retool.

Hey @MichaelT can you share how you have this set up? Just tested 2 different global js function definitions and they both seem to work. Happy to dig into your case here.

Global JS definitions:

Called in the app:

@joeBumbaca thank you for answer.

Here is few cases of the implementation by your examples that doesn't works.
I defined it in the App Preloaded JS in 2 different ways:

Inside the application it is showed as undefined. Even after page reload.
image

The same is here:


@MichaelT I believe this is failing because of the way getNames is defined. In the App level preloaded JS, you must use the window. syntax. The getNames function definition there is causing an error, which I believe is causing the properly formatted getEmail to fail as well.

If you remove getNames from that list (or assign it to the window), do things work for you?

Nope. Removing the getNames function doesn't make changes to getEmail functionality inside the app.

Hey @MichaelT do you have any preloaded JS in the org wide settings on the advanced tab? Mind sharing an export of the app so I can take a look as well? Thanks!

1 Like

@joeBumbaca yep, you are right. In the Advanced tab one of the functions we added was without closing curly brace. :slightly_smiling_face: :see_no_evil:
Thanks for help!

No problem! Glad you were able to find the culprit. Have a great day!