nuxt-hub / core

Build full-stack applications with Nuxt on CloudFlare, with zero configuration.
https://hub.nuxt.com
Apache License 2.0
835 stars 39 forks source link

Error in production build with @nuxt/content #18

Closed jankaderabek closed 3 months ago

jankaderabek commented 4 months ago

Thank you for the amazing module 👍 , really looking forward to using nuxthub console in production for my project.

I have an issue in my Nuxt app based on @nuxt/content module. The production build is broken when I add @nuxthub/core module.

image

I found it's caused by contents/index.yaml. Everything is fine if I remove this file and use .md based content.

Reproduction

Repository with reproduction: https://github.com/jankaderabek/content-bug

To reproduce:

Atinux commented 4 months ago

Hi @jankaderabek

So far @nuxt/content is not yet ready for the edge (only work with nuxt generate).

I plan to support a way to have a content based CMS into NuxtHub though, what is the most required feature you need from Nuxt Content?

For example, I made https://github.com/atinux/atinotes using hubKV() and using https://github.com/nuxt-modules/mdc to store the parsed content.

We also have https://github.com/unjs/confbox that can help on parsing YAML.

tahirmahmudzade commented 4 months ago

Thank you for the amazing module 👍 , really looking forward to using nuxthub console in production for my project.

I have an issue in my Nuxt app based on @nuxt/content module. The production build is broken when I add @nuxthub/core module.

image

I found it's caused by contents/index.yaml. Everything is fine if I remove this file and use .md based content.

Reproduction

Repository with reproduction: https://github.com/jankaderabek/content-bug

To reproduce:

  • run npm run build
  • run npm run preview
  • open the page in the browser and you can see 500

hey, I am facing this error once I try to build for the production:

✔ Server built in 8893ms                                                                                                          1:10:06 AM
ℹ Initializing prerenderer                                                                                                  nitro 1:10:06 AM

[1:10:13 AM]  WARN  "file:///Users/tahirmahmudzade/Documents/FOLDERS/Programming/Projects/EstateEcho/node_modules/.pnpm/nuxt@3.11.1_@unocss+reset@0.58.6_eslint@8.57.0_floating-vue@5.2.2_typescript@5.4.3_unocss@0.5_j233gehmcfiqwdmvm37ykfczmy/node_modules/nuxt/dist/core/runtime/nitro/cache-driver.js" is imported by "virtual:#internal/nitro/virtual/storage", but could not be resolved – treating it as an external dependency.

ℹ Prerendering 1 routes                                                                                                     nitro 1:10:16 AM
  ├─ /api/_content/cache.1710968983827.json (15ms)                                                                           nitro 1:10:16 AM
  │ └── Error: [500] 
                                                                                                                             nitro 1:10:16 AM
Errors prerendering:
  ├─ /api/_content/cache.1710968983827.json (15ms)                                                                           nitro 1:10:16 AM
  │ └── Error: [500] 
                                                                                                                             nitro 1:10:16 AM

 ERROR  Exiting due to prerender errors.

do you have any idea how to solve this? since you said changing to .md fixed the problem? I am using markdown for my content files as well

jankaderabek commented 4 months ago

@tahirmahmudzade Not sure if it's the same issue, try to update everything to the latest versions, my project started to work fine after that, it was probably related to this https://github.com/nuxt/content/issues/2580#issuecomment-1987174301

Atinux commented 3 months ago

Tested and now and it seems to work fine.

ra-jeev commented 3 months ago

@Atinux: Does @nuxt/content work now with nuxtHub?

I seem to be getting the same error during build which is mentioned by @tahirmahmudzade.

https://github.com/nuxt-hub/core/issues/18#issuecomment-2010653826

I added a log in nitropack to get more details and this is what I got:

{"url":"/api/_content/cache.1712310597363.json","statusCode":500,"statusMessage":"","message":"Missing Cloudflare KV binding (KV)","stack":""}

This happens in the generateRoute function. Stack trace:

  at generateRoute (node_modules/nitropack/dist/chunks/prerender.mjs:147:22)
  at async Promise.all (index 0)
  at async runParallel (node_modules/nitropack/dist/chunks/prerender.mjs:254:3)
  at async prerender (node_modules/nitropack/dist/chunks/prerender.mjs:203:3)
  at async node_modules/nuxt/dist/index.mjs:3471:7
  at async build (node_modules/nuxt/dist/index.mjs:5001:5)
  at async Object.run (node_modules/nuxi/dist/chunks/build.mjs:95:5)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1648:16)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1639:11)
  at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1777:7)
  ├─ /api/_content/cache.1712310597363.json (18ms)                nitro 3:20:46 PM
  │ └── Error: [500]