Hey,
if i get it right, this way it is another deployment of a worker script which i prefer to avoid.
if the initial deployment to a staging worker went smooth, i just need to swap between these two, because i know for sure the staging worker is up and running, and should remain “untouched”, besides (changing the worker name)
otherwise, something can get wrong on the second deployment, like env variables and stuff during the deploy process.
trying to reduce the risk of a bad deployment to 0
Unless a special API exists, I suppose you can’t swap names/values without a PUT and an intermediary/temporary variable.
But is the uploaded worker’s name so important ?
If you change routes it shall work.
And changing routes means you can generate any worker name, just like an id / hash / date.
Do you really need to call your workers staging and production ?
Can’t you store this information otherwhise, like { staging : stagingWorkerId, prod : prodWorkerId }
hmm interesting idea
it is making the “swap back” process a bit more complicated, because the idea is to also have the ability of quick swapping back. so if the “older” deployment isn’t called staging, for example, it will be called “my-worker-script-v1.0.1” then i’ll need to fetch this name from somewhere or keep a mapping of previous released somewhere outside of cloudfalre.
and this way also requires an API to change a route to a different worker without a worker script deployment