Closed CyberCowboy404 closed 2 months ago
Hey @CyberCowboy404 can you provide som repo and where you try to deploy please :) ?
I had the same issue. you need to use the runtime config and remove the config from nuxt.config.ts:
export const runtimeConfig: NuxtConfig['runtimeConfig'] = {
public: {
stripe: {
key: '',
},
},
stripe: {
key: '',
},
}
In Prod Environment:
NUXT_STRIPE_KEY=your private key
NUXT_PUBLIC_STRIPE_KEY=your public key
@ayalon I think I used this way but without any luck. Maybe I should try again, cause I decided to go with stripe libraries directly
@CyberCowboy404 You CANNOT use .env with Nuxt in a productive environment. You need to provide them within your hosting enviroment. .env File is only used in DEV mode: https://nuxt.com/docs/guide/directory-structure/env#production
After your server is built, you are responsible for setting environment variables when you run the server. Your .env files will not be read at this point. How you do this is different for every environment. This design decision was made to ensure compatibility across various deployment environments, some of which may not have a traditional file system available, such as serverless platforms or edge networks like Cloudflare Workers.
@CyberCowboy404 You CANNOT use .env with Nuxt in a productive environment. You need to provide them within your hosting enviroment. .env File is only used in DEV mode: https://nuxt.com/docs/guide/directory-structure/env#production
After your server is built, you are responsible for setting environment variables when you run the server. Your .env files will not be read at this point. How you do this is different for every environment. This design decision was made to ensure compatibility across various deployment environments, some of which may not have a traditional file system available, such as serverless platforms or edge networks like Cloudflare Workers.
Yeah I know, my project already in production a few months. It was a problem that I've struggled a lot, so I think i passed keys correctly. I also spent a lot time on this module to make it see key on the prod server. Now everything works, and I also use stripe keys from env variables with NUXT_ prefixes
Thanks for your feedback will close the issue for now then
During development everything working fine. But on the production when I check webhook, I'm getting error
no key given for server service
I see my ENV variables on the server, and I can see that all data is there.Can problem be because I use
I already noticed some bugs with nuxt, when it doesn't check vars I have not directly in
runtimeConfig