cloudflare / cloudflare/serverless-cloudflare-workers
Removal not working due to constructor promise not being returned and the now default multiscript support
- Lingua principale
- JavaScript
- Stelle
- 180
- Fork
- 34
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
We are using the serverless-cloudflare-workers plugin and have been deploying our functions to Cloudflare successfully for some time now. Given that the non enterprise accounts, provided the possibility to deploy just to the one worker, we never considered using the Remove functionality provided by this plugin. However, that changed recently when you announced multi script support for all customer (not only Enterprise). Since we wanted to take advantage of this, our CI/CD pipeline was updated to make use of the Serverless remove command, however on doing so, our multi script worker deployments and the respective routes were not being removed.
After numerous hours of debugging it looks like the issue is related to the process of triggering the promise from within the Remove constructor which was not being returned... so the process was exiting since serverless was not then aware that there are additional steps to execute.
```
diff --git a/node_modules/serverless-cloudflare-workers/remove/cloudflareRemove.js b/node_modules/serverless-cloudflare-workers/remove/cloudflareRemove.js
index 6db2fa8..b1b8e06 100644
--- a/node_modules/serverless-cloudflare-workers/remove/cloudflareRemove.js
+++ b/node_modules/serverless-cloudflare-workers/remove/cloudflareRemove.js
@@ -35,7 +35,7 @@ class CloudflareRemove {
if (this.options.function || this.options.f) {
throw new Error("This does not support -f yet.")
}
- BB.bind(this)
+ return BB.bind(this)
.then(this.remove)
.then(resp => console.log("Removed"))
}
@@ -50,7 +50,11 @@ class CloudflareRemove {
} = this.provider.config;
const functionKeys = this.serverless.service.getAllFunctions();
- const multiscriptEnabled = await this.checkAccountType();
+
+ // Cloudflare enabled multiscripts for everyone. No need to check anything
+ // const multiscriptEnabled = await this.checkAccountType();
+ const multiscriptEnabled = true;
+
```
The above patch is relatively crude but ensure that the remove process does indeed work
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia da remove/cloudflareRemove.js, in particolare dal costruttore Remove e dalla relativa catena di promise. Verifica che l’operazione di rimozione venga restituita e che la rimozione di più script e delle route associate funzioni senza il precedente controllo del tipo di account; il lavoro è completato quando il comando Serverless remove termina dopo la rimozione di tali risorse.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- cloud, devops
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100