Setting Variables when working with Vite.

I have a tanstack start project and I want to set some variables. I already set some secrets using the wrangler secret cli and it works fine but since there is no option from the CLI to set variables I thought the only way to put them in the wrangler.jsonc file but even then after deployment they dont' show. What am I doing wrong?
No description
No description
2 Replies
fawwaz
fawwazOP4w ago
My mental model has been from the docs that if you set the variables inside the Wrangler.jsonc in the next deployment, you should be able dashboard also. But that hasn't been the case. And I'm not sure what I'm missing.
FACELESSMAN
FACELESSMAN3w ago
I am also looking at this issue I want to deploy a vite site that has a production and a preview env within the same worker project...I set up two sets of variables within my wrangler.jsonc file:
"env": {
"production": {
"vars": {
"PROD_API_BASE": "https://api.example.com"
}
},
"preview": {
"vars": {
"PREVIEW_API_BASE": "https://api-preview.example.com"
}
}
}
"env": {
"production": {
"vars": {
"PROD_API_BASE": "https://api.example.com"
}
},
"preview": {
"vars": {
"PREVIEW_API_BASE": "https://api-preview.example.com"
}
}
}
but these variables arent being pushed upstream to cloudflare

Did you find this page helpful?