ENV variables with wrangler pages CLI (VITE REACT)
How do I add env variables to a deployment of a pages application? I am writing a github action that is suppossed to deploy my pages application, and I am trying to grap some secrets from the repo, and add them as env variables for the pages.
I have tried this:
But MY_VARIABLE does not show up in the pages dashboard. How can this be done?
2 Replies
You would have to manually run
wrangler pages secret put ...
before your deploy command
For non-secret and static vars, you could use wrangler.toml
nowadays too I believeOkay thank you!
So I tried those solution but they did not work. Because I was building my React app with Vite, the ENV variables were taken from the .env file. I ended up manually creating an .env file in my github action, like this:
And the working-directory of course being where my app is located and built from.