Skip to content

Commit 784fd58

Browse files
authored
docs: add debug recipe
1 parent 91a1d97 commit 784fd58

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
navigation:
3+
title: Debug Mode
4+
title: Debug Mode (Boot)
5+
description: Debug your Nuxt application when a boot error occurs on Cloudflare Workers.
6+
---
7+
8+
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.
9+
10+
The current solution to debug is the following.
11+
12+
1. Disable Nitro minification in your `nuxt.config.ts`
13+
14+
```ts [nuxt.config.ts]
15+
export default defineNuxtConfig({
16+
nitro: {
17+
minify: false
18+
}
19+
})
20+
```
21+
22+
2. Build your application for production with the Cloudflare Pages preset
23+
24+
```bash [Terminal]
25+
npx nuxt build --preset cloudflare-pages
26+
```
27+
28+
3. Preview the production server in the Worker environment
29+
30+
```bash [Terminal]
31+
npx wrangler pages dev dist/
32+
```
33+
34+
::warning
35+
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.
36+
::
37+
38+
4. Open the browser by pressing the **b** shortut (most of the time it starts on <http://localhost:8788>)
39+
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.
40+
41+
::note
42+
Most of the time, you will need to find scroll above to know what library is causing the error.
43+
::
44+
45+
6. [Open an issue](https://github.com/nuxt-hub/core) in our repository so we can help making more librairies Edge compatible.

0 commit comments

Comments
 (0)