> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: About Debugging Your Code in Studio Two

## Article: About Debugging Your Code in Studio Two

## Article Link: https://dev.wix.com/docs/studio-two/test-your-site/debug-your-code/about-debugging-your-code-in-studio-two.md

## Article Content:

# About Debugging Your Code in Studio Two

When your site's code doesn't do what you expect, use these tools to find out why:

- **Developer Console:** Shows uncaught errors from your frontend code, each with its file and line, in Preview, in the Studio Two editor.
- **Browser developer tools:** Show `console` output and uncaught errors from your frontend code, and your frontend source files, where you can set breakpoints. They work in Preview and on the live site.
- **Logs page:** Shows the log entries that your code writes with the monitoring client, and uncaught errors from your backend code. It's in your site dashboard, under **Developer Tools > Logs**.

These tools help with errors that happen while your code runs. For errors that the **Code** tab reports as you type, and for build errors, see [About Errors in Studio Two](https://dev.wix.com/docs/studio-two/test-your-site/debug-your-code/about-errors-in-studio-two.md).

## The Developer Console in Preview

When you preview your site in the editor, the **Developer Console** is at the bottom of the page. Open it to see uncaught errors from your frontend code, such as an Editor React Component (ERC). Each error shows the file and line in your site project, such as `src/extensions/site/components/team-card/team-card.tsx:38`. Expand an error to see its stack trace.

The **Developer Console** doesn't show `console` output, such as from `console.log()`, even with every option in **Logs Levels** selected. To see `console` output, use your browser's developer tools.

While you preview, a card at the side of the page also lists the errors. To have **Aria**, Wix's AI assistant, try to fix them, click **Fix all with AI**.

## Your browser's developer tools

Your site's frontend code runs in the browser, so you can debug it with the developer tools that come with your browser. Each frontend bundle comes with a source map, so the developer tools show your original files and line numbers instead of the bundled code:

- The console shows `console` output and uncaught errors, each with its file and line in your site project. This works in Preview and on the live site.
- The **Sources** panel lists your original files. You can open them and set breakpoints in them.

### Find your source files

The bundles that the browser loads have generated names, such as `component-<id>-<hash>.js`, but the developer tools list your original files too. In Chrome's developer tools, open **Sources > Page**. On the live site, your files are under a domain that ends in `wix-app-host.com`, in the same folders as in your site project, such as `src/extensions/site/components/team-card/`.

To open a file by name instead, press `Command+P` on macOS or `Control+P` on Windows and Linux in the developer tools, and type the file name. To pause on a line, open the file, click the line number to set a breakpoint, and reload the page.

### Your frontend code is public

The source maps include your original frontend code, so anyone who opens your live site can read that code in their browser's developer tools. Backend code runs on Wix servers and isn't sent to the browser.

## Backend code

Backend code, such as an HTTP endpoint, runs on Wix servers, so your browser's developer tools can't show it. To see what your backend code does, write log entries with the monitoring client and read them on the **Logs** page. `console` output from backend code doesn't appear on the **Logs** page. For how to write log entries, see [Write Log Messages in Studio Two](https://dev.wix.com/docs/studio-two/test-your-site/work-with-logs/write-log-messages.md).

When backend code throws an error that it doesn't catch, the error appears on the **Logs** page. When an HTTP endpoint throws, the code that called it gets a `500 Internal Server Error` response. The **Source file** column on the **Logs** page shows the name of a bundle, not your source file.

## Where output appears

The following table shows where each kind of output from your code appears:

| Output | In Preview | On the live site |
|---|---|---|
| `console` output from frontend code | Browser developer tools | Browser developer tools |
| Uncaught errors from frontend code | **Developer Console** and browser developer tools | Browser developer tools |
| Log entries that frontend code writes | Not written | **Logs** page |

A test site writes log entries the same way the live site does. Its log entries and uncaught backend errors appear on the **Logs** page together with the live site's, and nothing in an entry shows which one it came from. For more about test sites, see [About Preview and Test Sites in Studio Two](https://dev.wix.com/docs/studio-two/test-your-site/about-preview-and-test-sites-in-studio-two.md).

## See also

- [About Errors in Studio Two](https://dev.wix.com/docs/studio-two/test-your-site/debug-your-code/about-errors-in-studio-two.md)
- [About Preview and Test Sites in Studio Two](https://dev.wix.com/docs/studio-two/test-your-site/about-preview-and-test-sites-in-studio-two.md)
- [About Logs in Studio Two](https://dev.wix.com/docs/studio-two/test-your-site/work-with-logs/about-logs-in-studio-two.md)