Deploying Client Side Env Variables/Incorrect Useage?
I had client side env variables successfully running in production for a few days before they seemingly "turned off" (are undefined) - I didn't change anything (that I know of) This is how I use the variables
function isRunningLocally() { return window.location.hostname === 'localhost'; } if (!isRunningLocally()) { // this isn't running posthog.init(import.meta.env.REACT_APP_PUBLIC_POSTHOG_KEY!, { api_host: import.meta.env.REACT_APP_PUBLIC_POSTHOG_HOST, person_profiles: 'always', }); }
function isRunningLocally() { return window.location.hostname === 'localhost'; } if (!isRunningLocally()) { // this isn't running posthog.init(import.meta.env.REACT_APP_PUBLIC_POSTHOG_KEY!, { api_host: import.meta.env.REACT_APP_PUBLIC_POSTHOG_HOST, person_profiles: 'always', }); }