Error calling a custom function from a custom function

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.

image

Hi Marc,

We need to know the following:

  1. Your app id
  2. Name of the function that calls another function
  3. Name of the page where (2) is used.
  4. Step-by-step instructions for duplicating the error in your app.

Regards,
Mark

Hi Mark,

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.

Please see attached.

Regards,

Marc

Thank you for this information, but I can’t reproduce that :frowning:

Could you tell me an order of your actions? What function was created first?

Also I’ve created an internal ticket(BKNDLSS-27935) to investigate this issue, and your information would speed up this process.

Regards, Dima

Hi @Marc_Chriqui, did you manage to find a solution ?

I did try to replicate your Function2 > Function1 > OnClickEvent above, and as for the Backendless team, it seemed to work OK.

However, in my context, I run into the same kind of problem you have. Here is my similar issue : a TypeError [...] is not a function error message.

@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.

Please note this also happens when a single function is called from a reusable component, somehow like here : UI Builder Custom Function Not Working in Reusable Component

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.

Hi @Nicolas_REMY ,

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.

Regards, Andriy

Hi @Andriy_Konoz , thank you for your reply. No worries, will wait.

Just wasn’t sure if this was being worked on, or perceived as a single-user glitch. Just wanted to confirm I also encountered this issue.

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! :slight_smile:

1 Like

Hi, @Marc_Chriqui

That’s good to hear. If you have any further issues with calling functions from a function, please let us know.

Regards,
Marina

1 Like

Hi, is there any news about issue BKNDLSS-27935 ?
I once again ran into the problem of calling a function from a function, and got a TypeError.

Hi @Nicolas_REMY

We had stopped investigating it because we could not reproduce it and seems like the issue was gone for @Marc_Chriqui

Let me check this right now

@Nicolas_REMY

It works well for me, could you please provide your appId and link the preview page to see the issue

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

Hi @vladimir-upirov ,

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.

Nicolas