#useRuntimeConfig empty on server-side
7 messages · Page 1 of 1 (latest)
Have you defined your variables in the nuxt config file? https://nuxt.com/docs/api/composables/use-runtime-config#define-runtime-config
yes I have
runtimeConfig: {
public: {
token: process.env.NUXT_CLIENT_TOKEN,
apiUrl: process.env.NUXT_API_URL,
}
},
inside my composable I call then useRuntimeConfig().public. Locally it works fine but on production it never finds these values. But when I log process.env I can see them
we are using azure app service where we add the env values
Same problem here, for now, i get it works only like this:
NUXT_APP_MODE=production NUXT_PUBLIC_BASE_API_BROWSER_URL=http://localhost:9999/megaApi/ PORT=8001 node .output/server/index.mjs
After that, i can get environments values on server side