-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |