Hi. I called a custom function from another custom function in UI builder (using the custom function block) and got the attached error, which I was unable to resolve. I tried making changes to the page to trigger a rebuild, but the error persisted. I ended up being forced to move the code outside of the “called” function and into the “calling” function. The code then worked, so the error was not in the code itself. Hopefully you’ll be able to reproduce and resolve the issue.
I no longer have the logic in my app however I was just able to reproduce the issue in less than a minute, which your team would easily be able to do as well. I created two custom functions (Function1 calling Function2) + a page with a button that calls Function1. The error appears following the button click.
@Backendless, in case you can help me understand, my app id is D7075715-5086-625A-FFAB-39C2F40FB200. In my case the problem happens immediately when loading the page B2-edit-my-boat. There are two custom functions, one calling the other and this happens consistently.
In that case, I first get an error message on application load reading Uncaught SyntaxError: await is only valid in async functions and the top level bodies of modules and then the TypeError […] is not a function happens on execution.
Sorry for inconvenience. We are still investigating this problem. Investigation performed in scope of BKNDLSS-27935. Unfortunately I can’t suggest any bypass at the current moment.
Hi everyone. I just implemented my Function1 and Function2 example above again, and this time it worked as expected, with no error. I didn’t do anything different (created Function2 first, then Function1, then called Function1 from the page, all in the same app), so I’m not sure what might have changed in the platform, if anything. Hopefully @Nicolas_REMY’s issue can be figured out. Calling functions from functions is very useful. Thanks + happy codeless coding!
btw, is there any change you remove a function and then recreate it with the same name (for instance: Function2) in this case, the error is expected, because each function has own id which is stored in logic where you use it
Thanks for coming back quickly.
I’m afraid it was a false alert on my behalf. The issue was not that the functions were called within one another, but rather that the variables had the same name as you had already pointed out a few weeks back. Sorry for the disturbance.