Backend Debugging

Any plans for better debugging for backend code on a published site? Used to be able to console.log but looks like that has changed for security reasons.

Can insert code into a collection to read it but its a fairly cumbersome solution.

Mainly asking because once we’re using Users/Members the preview function becomes pretty useless, so we have to test in the published site.

You can use the Site Monitoring feature . See the site-monitoring API for additional details.

Another simple option is to “write” debug statements to a database collection as a homemade console log. You can then view the db collection to inspect the “log”.

Cheers will have a look

@yisrael-wix should Site monitoring work with backend console.log, or is there another way? You seem to imply it should work, but I don’t see it, as @Luke says

see here: https://support.wix.com/en/article/corvid-about-site-monitoring
console.info() should appear in the site monitoring

For those who don’t like to read that much.

You can console.log() your backend extremely easy.

Go to your Wix dashboard - settings - site monitoring.

There click the “OPEN” button. Once this is ready.

Using your live site run it, run from your frontend a promise that calls for a backend function, if the backend function contains a CONSOLE.LOG() this console will be displayed in the site monitoring as a JSON object.

this is site monitoring on action:

Then click on any of the logs:

The jsonPayload contains always your console.log() from the backend.

And then keep in mind ALWAYS this message comes in an array, your console.log() is everything but the array.

In this case “controller has been called from not submit” is a string that I wrote in my console.log(); method.

This is already well documented in the Wix Support page, as shown in your duplicate post here.
https://www.wix.com/corvid/forum/community-discussion/console-log-directly-from-the-backend

And exactly like Yisrael and Ohad have already posted the links to above, it is also shown in its own support pages here.
https://support.wix.com/en/article/corvid-about-site-monitoring
https://www.wix.com/corvid/reference/site-monitoring.html