Hydrogen v1 - How to access env variables in client component using Oxygen? #668
Replies: 5 comments 11 replies
-
Yeah, we ran into this too.
|
Beta Was this translation helpful? Give feedback.
-
You can proxy desired ones from server to client using react context |
Beta Was this translation helpful? Give feedback.
-
Can you go into a bit more detail on this? Trying to leverage branch based environment variables in GitHub actions to define my Sanity datasets in sanity.config. But it seems like Hydrogen doesn't really provide a solid way to pass in Env vars to client side. |
Beta Was this translation helpful? Give feedback.
-
Oxygen and Hydrogen v1 are an absolute nightmare I lost about 4-5 days trying to get it to work, i've since reverted back to VITE / |
Beta Was this translation helpful? Give feedback.
-
Guys, have you resolved it? |
Beta Was this translation helpful? Give feedback.
-
Hi, We need to access some ENV vars in client components which worked fine using VITE and deploying to Vercel, but once migrating to Oxygen I can no longer work out how to access env vars in a client component once deployed. It works locally if I use import.meta.env but that doesn't work once deployed to Oxygen, and Oxygen.env only works in server components.
Can anyone help?
Beta Was this translation helpful? Give feedback.
All reactions