Problem

This section explains the solution if you see a “Bad Gateway” error when opening the MDX preview or the Pages section, as shown below.

Solution

The cause of this issue is that the Vite server, which displays the MDX preview, is not running. There are two ways to resolve this:

Solution 1: Reload the Entire Page

In Morph’s workspace, the Vite server is automatically started when the workspace is launched. Therefore, simply reloading the page should restart the Vite server, allowing the page to display correctly.

Solution 2: Start the Vite Server from the Terminal

Run the following command directly in the terminal from the Code section.

Once the command successfully runs and the Vite server starts, you should be able to access the preview.

npm run 'page:start'

In Case the Issue Persist

If neither solution resolves the issue, there might be a problem with the package initialization.

Execute the MDX setup command outlined on this page in the terminal to initialize the package, then try the above solutions again.