My front end calls to functions in the backend no longer work.
They used to, and I have made no changes.
Why does this simple case fail?
In database.jsw:
//================================================================
export function test(message) {
return ("test: " + message)
}
//================================================================
In masterPage.js:
import {test} from 'backend/database.jsw';
$w.onReady(async function () {
console.log("masterPage page is running.");
console.log(await test("From masterPage!"));
console.log("Did test run?");
}
The first console call executes normally.
The second console call causes an error.
The third console call never executes.
Here is the console error:
console.js:35 Error
at i (wixCodeNamespacesAndElementorySupport.min.js:1)
at XMLHttpRequest.n.onreadystatechange (wixCodeNamespacesAndElementorySupport.min.js:1)
at XMLHttpRequest.wrapped (raven.js:376)
e.<computed> @ console.js:35
Kateryna. Thank you very much for your attention to this issue,
I have submitted a ticket as you suggested.
Bill
Hi Bill!
This is Kateryna from Wix Velo team. I am sorry to know that you are experiencing the issue.
From the description you have provided here, it does look like Kristof is correct.
Please note that, due to security regulations, we cannot make changes to the site unless we confirm the domain and that you are the site admin. Therefore, it would be perfect if you could open a ticket to Customer Support, so that we have the details of your account. In the meantime, I had a look at the live version of what I believe your site is, and could see that you have changed the code since the issue was reported. You commented out the code and I could not see the logs. I have recreated the same site layout and code in my own account, commented out the Home page code and imported the backend test() function in the masterPage.js file, and could see that the logs have been successfully returned. Here are some screenshots:
Tested in both old and new configurator, as mentioned before, and both were performing correctly.
However, I understand that the issue might still occur on your end, and we would definitely want to investigate it as soon as possible. Please, open the ticket or provide the account email/domain name in this post, and we would be happy to further assist you! Kind regards,
Kateryna,
Velo Product Support Specialist
Hi bill, I had the same problem a few days ago; The problem probably will be because of an old configuration https://www.wix.com/velo/forum/main/comment/5fb3a9c50eac760017932700 they did the same for me back then. Now someone from Velo changed the configuration back so i do get the new releases and the problem should be gone. Kind regards, Kristof
Try adding async to the backend function to call it in the frontend like you did.