#useRuntimeConfig empty on server-side

7 messages · Page 1 of 1 (latest)

daring pivot
#

When I use runtime config on server side in production inside my composables it returns empty but the process.env has the values I can see that through a console log. Are there restrictions where I can use useRuntimeConfig composable? The odd thing is that it works locally without any issues.

languid whale
daring pivot
#

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

daring pivot
#

we are using azure app service where we add the env values

rose fossil
#

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