Hello Wix coders,
I used to be able to see the backend data.js console logs in the Chrome dev tool. Now it won’t work anymore.
Without it, it is very difficult to debug the hooks. Ideas from anyone?
Hello Wix coders,
I used to be able to see the backend data.js console logs in the Chrome dev tool. Now it won’t work anymore.
Without it, it is very difficult to debug the hooks. Ideas from anyone?
Are you able to see the console logs in other browsers?
Perhaps you don’t see the console logs because the hooks aren’t being executed?
If you continue to have problems, please post the URL of your site. Only authorized Wix personnel can get access to your site in the editor.
I tried on 2 different Chrome browsers. The console log won’t show.
The hook works because I tested it by writing something to a field in the collection. It looks like this:
export function enrollment_beforeUpdate(item) {
item.memberFullName = 'This is a test'; //<-----Test the hook
console.log('enrollment_beforeUpdate') //<––– This won't show in the Chrome dev tool.
return item;
}
I used to be able to test the hooks by editing the database using the Wix database web app. The console log used to show until a few days ago after the Wix Dashboard and Database app interface has changed.
Here is my web app in development. I do have a paid account. Just using the free account for development. Once we finish user testing, we will switch it to the paid site.
https://digismarties.wixsite.com/gmt-dev-v3
Thanks so much for looking into it. We love Wix code!!
I took a quick look at your site. Found an error on the home page:
Also, your console.log() statement is missing a closing semicolon ;
Other than that, how are you testing it and when do you expect to see the console.log() output?
Hmm…that’s not an error. If you mouse click the code editor, it will go away.
Yes, the semicolon is my mistake. But it shouldn’t matter for testing because I am using the latest Chrome. It will handle ES6. ES6 ignores semicolons. But I don’t usually do that. Just this is in a hurry.
The way I test the hook is to use the Wix Database app and edit the collection directly. The console.log used to show on the Chrome Dev tool. As you can see, all the hooks in data.js is filled with console logs. I used to test all the previous hooks that way.
You may try to edit the ‘enrollment’ collection and change the ‘paidBy’ field. See if it shows in your Chrome Dev tool.
Thanks.
Doesn’t matter what Chrome does with ES6 - it matters what Wix Code does with ES6 as Wix Code does the translation.
I’ll try playing with the database in the database app. If you can tell me some sample scenarios, maybe even a screen shot or two, that would help.
Okay, thanks for your time on this. You may try using the ‘enrollment’ collection and change ‘paidBy’ field in the top item. Please see screenshot.
I changed the code so that it should write ‘Hello Wix team’ to the ‘memberFullName’ field. And it should console log it as well.
Oh I got it. You were testing it using the table inside the Editor. Yes, it is showing the console log.
But anyways if that’s not available anymore, that’s okay. I just have to use the table in the Editor for testing. Just a bit more clumsy.
I am removing the test code now. I appreciate your help.
Tried it in the dashboard and didn’t get the messages. Maybe I tried it after you removed the messages.
Sorry I couldn’t be of any more help. In any case, I hope you’re able to get done what you need.
Have fun!
I am glad you tried it. It is clear to me that something changed. Maybe it is to make the backend code more secure so that there is no chance to expose data inadvertently. It is not a huge deal. Thanks Yisreal for your support. Have a good week.
Hey Keawe,
Great minds think alike . I was thinking about this for a while and (like you) came to the conclusion that it actually makes a lot of sense to block console.log() output from the database hooks in the database app due to data protection and security. Looks like the Wix dev guys are a smart bunch.
It was good working together with you. You too have a great week.
Yisrael