I am currently having some logic to load some secrets which i based on the NODE_ENV but process.env.NODE_ENV inside the function was giving me undefined I have went and tried process.env.CONTEXT and got the same result.
Where have you defined the STRIPE_SK_DEV and STRIPE_SK_PROD environment variables? Only variables defined in the UI are available to functions at runtime as described here.
The STRIPE_SK_DEV and STRIPE_SK_PROD are well defined in the UI and they are not the problem in my case as they load properly. my question is regarding the NODE_ENV and/or the CONTEXT variable which are supposed to be defined by default. and without any of the two i can’t switch between stripe variables.
I can confirm that the process.env inside the function doesn’t have any env variable that helps me catch the running context production or development etc… so my question is then what is the way of doing that with netlify functions?
I appreciate your reply. However setting NODE_ENV to production in the UI will break the build step as yarn/npm won’t install dev dependencies which some are used in the generate step of Nuxt.
I have found the solution to the problem by using a build plugin referenced in other threads in the forum.