Can't use env from cloudflare in deployed workers with ci/cd
My Wrangler GitHub Action isn't applying environment variables set in the Cloudflare dashboard to deployments made by uploading the dist folder. The Action seems to require a build step first, but even after building, the uploaded dist content doesn't access the dashboard-configured environment variables.
2 Replies
GitHub Actions don’t have access to variables set on the Cloudflare Dashboard
If your secret is on the dashboard, you just deploy without it, and it will be present
@HardlyWorkin' thanks for you answer.But It can't access the env from the dashboard in my deployed website with github actions.
What I did is that I build the project inside GH action and upload the dist folder with wrangler. I've already setup env in dashboard, but can't access via my deployed version.
It works when I deploy from local-machine using command like "wrangler deploy" from terminal. But not in GH actions.
In the case of local-deployment with coludflare-vite-plugin, I don't even need to set env in dashboard. How it can be done?
When it comes to "manual-deployment", I think cloudflare let uploading the "asset-folder" with already injected env. For the manual deployment using "wrangler/action", it just deploy instead of building the app on the cloudflare, So I think I can't bind any env until I "injecting env with manual-build" before deploy.
So that, I will always need to add "github-repo-secrets" for every secret-env of my app for the build-process to deploy manually.