Using `useSiteConfig` inside a server route fail
Barbapapazes opened this issue · comments
Estéban commented
Describe the bug
Hello,
I'm trying to use the composable useSiteConfig
inside a server route and I got this error.
Reproduction
No response
System / Nuxt Info
------------------------------
- Operating System: Linux
- Node Version: v18.16.1
- Nuxt Version: 3.6.5
- Nitro Version: 2.5.2
- Package Manager: pnpm@8.6.12
- Builder: vite
- User Config: app, modules, css, nitro, content, unocss, site, sitemap, devtools
- Runtime Modules: @nuxt/content@2.7.2, @vueuse/nuxt@10.3.0, @unocss/nuxt@0.54.3, nuxt-simple-robots@3.1.0, nuxt-simple-sitemap@3.1.5, @nuxthq/studio@0.13.4
- Build Modules: -
------------------------------
Harlan Wilton commented
Can you provide the code you're using and in what context exactly?
In Nuxt server code the usage should be the same, but in Nitro code you need to pass the H3Event in as the first argument.
const siteConfig = useSiteConfig(event)
Estéban commented
Will check, thx
Estéban commented
Can you provide the code you're using and in what context exactly?
In Nuxt server code the usage should be the same, but in Nitro code you need to pass the H3Event in as the first argument.
const siteConfig = useSiteConfig(event)
Ho nice, it works so well!