harlan-zw / nuxt-site-config

Unifying site config with powerful and flexible APIs, for module authors and users.

Home Page:https://nuxtseo.com/site-config

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using `useSiteConfig` inside a server route fail

Barbapapazes opened this issue · comments

Describe the bug

Hello,

I'm trying to use the composable useSiteConfig inside a server route and I got this error.

image

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:    -
------------------------------

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)

Will check, thx

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!