Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal not working due to constructor promise not being returned and the now default multiscript support #39

Open
dietkinnie opened this issue Jun 7, 2019 · 0 comments

Comments

@dietkinnie
Copy link

dietkinnie commented Jun 7, 2019

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

@dietkinnie dietkinnie changed the title Removal not working due to constructure promis not being returned and the now default multiscript support Removal not working due to construct promis not being returned and the now default multiscript support Jun 10, 2019
@dietkinnie dietkinnie changed the title Removal not working due to construct promis not being returned and the now default multiscript support Removal not working due to construct promise not being returned and the now default multiscript support Jun 10, 2019
@dietkinnie dietkinnie changed the title Removal not working due to construct promise not being returned and the now default multiscript support Removal not working due to constructor promise not being returned and the now default multiscript support Jun 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant