visit
Velo functionality is only available when you enter Preview Mode from the Editor and not from the Site Actions dropdown in the Dashboard.
Differences Between Preview and Published Site
Although your can view your pages and interact with your site and data in Preview mode, the site will not behave exactly as it will when published:You can test a release candidate of your published site on a small percentage of visitors using the . This is helpful for testing functionality that only works on a published site without exposing that functionality to all site visitors.
To view the Developer Console:
In Preview mode, click the arrow at the bottom of the page.Note:
The Developer Console is collapsed by default unless your code has errors or you logged messages to the console.
To clear messages from the Console:
Click Clear Console on the Console menu bar.
To filter Console messages:
Click Default View on the Console menu bar, and then choose which kinds of messages you want to see.
Functional Testing for Backend Functions
Debugging code from the backend is challenging because you need to invest effort to trigger the code and test it, such as calling functions from the client side on a test page in your site. To save you time and effort, Velo enables directly from the code panel. The output you see in the test tab is the same as the output you would see in the Developer Console if you previewed your site and triggered the function.HTTP Functions
You can debug by adding
console.log()
calls to them. The information you log appears in your site's Developer Console when previewing your site. Since message logging only runs in preview, you need to call the testing version of your endpoints to see what is logged.To debug using
console.log()
in an HTTP function:console.log()
in your HTTP function's code.Note
You can also debug HTTP functions using .
Client-Side Source Files
You can debug your client-side code using developer tools. These tools are not part of Wix, they come with your browser. You can debug them as you would any other site by setting breakpoints, logging to the console, etc. If you are new to debugging, click to learn how to log messages to the console.You can open a copy of your site code source files from the browser's developer tools. First identify the names of the files that contain your site's client-side code. The names of these files appear in the Wix Developer Console when you preview your site.Backend Code & HTTP Functions
Because of security concerns, messages in backend code are not logged to the browser's console on the published version of your site.Because HTTP functions are not browser based, messages are not logged to the console when viewing the published version of your site.You can use to view console messages in backend code and HTTP functions on the published version of your site.Source Maps
When you debug your code in the browser it looks just like your original source code. In reality, the code you write is not the actual code that is run. The usage of source maps means that you don't need to worry about what's going on behind the scenes. But if you're curious to know, this is what's happening.Velo supports writing code using the ES2017 standard. But until this standard is fully implemented in all browsers, your code is transpiled from ES2017 code to ES5. Your code is also minified, and source files are combined to make their delivery from the server more efficient.So the code that's actually being run on your site is transpiled, minified, and combined. You don't want to have to debug that generated code. You want to debug the code you wrote originally. That's where source maps come in. A source map is a file that maps the lines of code that the browser is actually running to the lines in your original source code. When you want to debug some code, the source map lets you find the code in the original version that you wrote, even though the debugger uses the source map to run the corresponding generated code. All this should happen without you having to do anything. If you’re having trouble, check your browser’s developer tools settings and make sure that source maps are enabled.Wix's tool allows you to debug your site by generating and tracking logs. Site Monitoring is located in your site's , under Settings.
Notes
• You can use site monitoring to generate logs from client-side code, backend code, public code, HTTP functions, or anywhere else in your site.
• You can monitor site logs in both Preview mode and on your published site.
Live Site Events
You can view event logs in real time in the Site Events window. Simply add a to any code in your site, trigger the code in Preview mode or on your published site, and the log will appear in your Site Monitoring site events window.Google Operations
For more robust log analysis, you can easily connect your Wix site events to Google Operations, an external monitoring tool.Learn more about:console.log("Inside myFunc(). Value of myVar is: ", myVar);
Previously published at