"Update name in Wrangler configuration file to match deployed Worker" even though name is the same

Hey everyone, I took an existing github project of a cloudflare worker, removed my old deployed workers via the dashboard and then created a new one from that github repo. Reason being that I'm switching from my self-built github actions to the new worker preview feature. So I enabled it and now every time I push, the cloudflare integration opens a pull request to change the name of the worker in the worker configuration. The issue is that the name is exactly the same, and said pull request ends up with no file changes. My worker is built using react-router and the cloudflare vite plugin. I defined a "production" environment in the wrangler configuration, Which means I'm setting the environment to use at build time, not at deploy time. Since the vite plugin creates its own internal wrangler config, is this what causes the bug? Since deploying on the production env will change the name to "<worker_name>-production"? The documentation says that the environment names shouldn't cause this issue. However my original connection to github initially deployed the "default" environment, so the suffix is not there..
3 Replies
Mokacchi
MokacchiOP2w ago
I could imagine that the problem really stems from me adjusting the build command to use a different environment.
No description
Mokacchi
MokacchiOP2w ago
Maybe my understanding is completely off here. Despite having "Builds for non-production branches" be a thing now, a single worker in the Workers & Pages in the dashboard can still only have a single environment, and the environment suffix needs to be part of the worker name in the dashboard, correct? That means I can deploy a worker for the "production" environment and get preview urls for them, and that will create a "<worker-name>-production" worker in the dashboard, but if I wanted to use a different environment for preview urls, that would not be possible with this setup?
Mokacchi
MokacchiOP2w ago
https://developers.cloudflare.com/workers/ci-cd/builds/advanced-setups/#example-1 I found something (by mere chance) that explains exactly what I need and takes preview urls into consideration :MeowHeartCloudflare:
Cloudflare Docs
Advanced setups · Cloudflare Workers docs
Learn how to use Workers Builds with more advanced setups

Did you find this page helpful?