Skip to content

Commit

Permalink
docs: add debug recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Aug 1, 2024
1 parent 91a1d97 commit 784fd58
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions docs/content/1.docs/4.recipes/4.debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
navigation:
title: Debug Mode
title: Debug Mode (Boot)
description: Debug your Nuxt application when a boot error occurs on Cloudflare Workers.
---

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`

```ts [nuxt.config.ts]
export default defineNuxtConfig({
nitro: {
minify: false
}
})
```

2. Build your application for production with the Cloudflare Pages preset

```bash [Terminal]
npx nuxt build --preset cloudflare-pages
```

3. Preview the production server in the Worker environment

```bash [Terminal]
npx wrangler pages dev dist/
```

::warning
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.
::

4. Open the browser by pressing the **b** shortut (most of the time it starts on <http://localhost:8788>)
5. 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.

::note
Most of the time, you will need to find scroll above to know what library is causing the error.
::

6. [Open an issue](https://github.com/nuxt-hub/core) in our repository so we can help making more librairies Edge compatible.

0 comments on commit 784fd58

Please sign in to comment.