Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to query localized content in Nuxt Content with experimental clientDB and no SSR #2846

Open
dxlliv opened this issue Nov 15, 2024 · 0 comments
Labels
v2 Relevant for @nuxt/content v2

Comments

@dxlliv
Copy link

dxlliv commented Nov 15, 2024

Environment

Nuxt version: 3.14.159
Nuxt Content version: 2.13.4
SSR: false

Error happens during development and after server side content generation.

Reproduction

https://stackblitz.com/edit/sos-nuxt-content-npcvlj?file=nuxt.config.ts

It works with default language
https://sosnuxtcontent-ewna--3000--f565b097.local-credentialless.webcontainer.io/omg/error

but not with secondary languages
https://sosnuxtcontent-ewna--3000--f565b097.local-credentialless.webcontainer.io/it/omg/errore

Describe the bug

Hi, I'm experiencing an issue while querying localized content with Nuxt Content in a setup with SSR: false and experimental.clientDB enabled.

Following the suggestion in issue #2062, I enabled clientDB to make Nuxt Content work with static generation and ssr: false. Everything happily worked as expected until I tried filtering content by locale.

I'm on latest versions of Nuxt and Nuxt Content.
Here's a code example of how I'm filtering content by locale:

const myItems = ref([]);

await useAsyncData(queryContentKey, async () => {
  const document = await queryContent(queryContentKey).locale(locale.value).findOne()

  myItems.value = document.list
})

With .locale(locale.value) it doesn't retrieve anything, but if I disable the experimental DB client it works again.

Additional context

I'm using clientDB as suggested in issue #2062, because without it, querying content with SSR: false results in a 404 error on the generated content. I'm building an app with Capacitor and need to keep SSR: false; otherwise, the app size increases significantly (200MB with SSR vs. 24MB without).

@dxlliv dxlliv added the v2 Relevant for @nuxt/content v2 label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2 Relevant for @nuxt/content v2
Projects
None yet
Development

No branches or pull requests

1 participant