SQLite3Error: No Such Table When Switching Locales in Nuxt Content v3 #3183
-
I'm using Nuxt Content v3.2.1 with localized content. Everything works fine when I first load the app at However, when I switch back to
Here is my import { defineCollection, defineContentConfig } from '@nuxt/content'
export default defineContentConfig({
collections: {
content_en_US: defineCollection({
type: 'page',
source: {
include: 'en-US/*.{md,yml}',
prefix: '',
},
}),
content_tr_TR: defineCollection({
type: 'page',
source: {
include: 'tr-TR/*.{md,yml}',
prefix: '',
},
}),
},
}) My directory structure looks like this:
This is how my <script setup lang="ts">
import type { Collections } from '@nuxt/content'
const { locale } = useI18n()
const { data: page } = await useAsyncData(
`index-${locale.value}`,
async () => {
try {
const collection = (`content_${locale.value.replace('-', '_')}`) as keyof Collections
const result = await queryCollection(collection).where('stem', '=', 'index').first()
if (!result)
throw new Error('Page data is empty')
return result
}
catch (err) {
console.error('Failed to fetch page:', err)
return null
}
},
{
watch: [locale],
},
)
if (!page.value) {
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
}
</script> |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
is this somehow related with #3182 ? edit: downgrading to 3.1.1 fixed this issue. |
Beta Was this translation helpful? Give feedback.
is this somehow related with #3182 ?
edit: downgrading to 3.1.1 fixed this issue.
edit 2: see #3188