Debugging

Learn how to debug your Nuxt application which cannot start on Cloudflare Workers / Pages.

Some Nuxt modules or librairies you use in your project may not be compatible with the edge runtime yet. When this happens, your Nuxt server cannot even start in production, producing a 500 error.

The current solution to debug is the following.

  1. Disable Nitro minification in your nuxt.config.ts
nuxt.config.ts
export default defineNuxtConfig({
  nitro: {
    minify: false
  }
})
  1. Build your application for production with the Cloudflare Pages preset
Terminal
npx nuxt build --preset cloudflare-pages
  1. Preview the production server in the Worker environment
Terminal
npx wrangler pages dev dist/
As we don't support generating the wrangler.toml so far, you may expect some 500 errors when accessing the database, kv, cache or blob.
  1. Open the browser by pressing the b shortut (most of the time it starts on http://localhost:8788)
  2. Go back to your terminal and look at the error and stack trace, then open the file (should be in the dist/ directory) to know the line causing the error.
Most of the time, you will need to find scroll above to know what library is causing the error.
  1. Open an issue in our repository so we can help making more libraries Edge compatible.