nuxt / content

The file-based CMS for your Nuxt application, powered by Markdown and Vue components.
https://content.nuxt.com
MIT License
3.01k stars 605 forks source link

Prerender doesn't work anymore (2.13.0 related) #2678

Open owljackob opened 5 days ago

owljackob commented 5 days ago

Environment

Reproduction

  1. Upgrade to 2.13.0
  2. Deploy through GitHub Action to Azure Static Web Apps

Describe the bug

After upgrading to 2.13.0, the prerender exits due to errors

Additional context

No response

Logs

[info] [nitro] Prerendering 2 routes
[log] [nitro]   ├─ /api/_content/cache.1719173388066.json (1998ms)
[log] [nitro]   ├─ / (2057ms)
[log] [nitro]   ├─ /api/_content/query/WQ2sbMtXQZ.1719173388066.json (16ms)
  │ ├── Error: [404] Document not found!
[error] Exiting due to prerender errors.
  at prerender (node_modules/nitropack/dist/chunks/prerender.mjs:218:11)
  at async node_modules/nuxt/dist/index.mjs:3540:7
  at async build (node_modules/nuxt/dist/index.mjs:5333:5)
  at async Object.run (node_modules/nuxi/dist/chunks/build.mjs:94:5)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.6aad497e.mjs:1648:16)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.6aad497e.mjs:1639:11)
  at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.6aad497e.mjs:1777:7) 

[error] Exiting due to prerender errors.
  │ └── Linked from /
[log] [nitro]   ├─ /api/_content/query/IP2VeCTPtf.1719173388066.json (15ms)
[log] [nitro]   ├─ /_payload.json (3ms)
[log] [nitro] 
Errors prerendering:
[log] [nitro]   ├─ /api/_content/query/WQ2sbMtXQZ.1719173388066.json (16ms)
  │ ├── Error: [404] Document not found!
  │ └── Linked from /
[log] [nitro]
ptdev commented 4 days ago

Hi,

I'm also getting this issue.

(...)
ℹ ✓ built in 7.23s                                                    11:11:42 AM
✔ Server built in 7236ms                                              11:11:42 AM
ℹ Initializing prerenderer                                      nitro 11:11:42 AM
ℹ Prerendering 2 routes                                         nitro 11:11:47 AM
  ├─ /api/_content/cache.1719223886273.json (1145ms)             nitro 11:11:48 AM
  ├─ / (1494ms)                                                  nitro 11:11:48 AM
  │ └── Error: [500] 
                                                                 nitro 11:11:54 AM
Errors prerendering:
  ├─ / (1494ms)                                                  nitro 11:11:54 AM
  │ └── Error: [500] 
                                                                 nitro 11:11:54 AM

 ERROR  Exiting due to prerender errors.                               11:11:54 AM

  at prerender (node_modules/nitropack/dist/chunks/prerender.mjs:218:11)
  at async node_modules/nuxt/dist/index.mjs:3540:7
  at async build (node_modules/nuxt/dist/index.mjs:5333:5)
  at async Object.run (node_modules/nuxi/dist/chunks/build.mjs:94:5)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.6aad497e.mjs:1648:16)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.6aad497e.mjs:1639:11)
  at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.6aad497e.mjs:1777:7) 

 ERROR  Exiting due to prerender errors.                               11:11:54 AM

Have no idea how to debug this :-/

ptdev commented 4 days ago

Hey again,

So I've pinpointed the issue to this commit.

When using i18n, the content folder usually doesn't have an index file and instead we split it by language, so all the content folder has are subfolders for each language ( content/en, content/fr, etc).

That commit apparently tries to add a non-existing route to the prerender array, which in turn errors out.

Cheers

ydnar commented 15 hours ago

This broke production for us, because / was pre-rendered with staging configuration. What’s the best way to disable pre-rendering of /, or any HTML?

owljackob commented 15 hours ago

This broke production for us, because / was pre-rendered with staging configuration. What’s the best way to disable pre-rendering of /, or any HTML?

Switch to the Edge Channel, it was fixed there, after it's released outside, you can switch back to stable.