When I run the command "firebase deploy --only functions" it takes around 1 minute to deploy my function even if I didn't update my function.
Am I doing something wrong?
Could it be because of the node_modules folder in my functions folder?
Is function deployment in firebase just slow?
Console Log:
C:\Users\myUser\Desktop\myProject> firebase deploy --only functions
=== Deploying to 'myProject'...
i deploying functions
i functions: ensuring necessary APIs are enabled...
+ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (36.96 KB) for uploading
+ functions: functions folder uploaded successfully
i functions: updating Node.js 10 (Beta) function myFunction(europe-west1)...
i scheduler: ensuring necessary APIs are enabled...
i pubsub: ensuring necessary APIs are enabled...
+ scheduler: all necessary APIs are enabled
+ pubsub: all necessary APIs are enabled
i functions: scheduler job firebase-schedule-myFunction-europe-west1 is up to date, no changes required
+ functions[myFunction(europe-west1)]: Successful update operation.
+ Deploy complete!
It usually gets stuck for 1 minute on this line:
i functions: scheduler job firebase-schedule-svt-europe-west1 is up to date, no changes required
The function itself takes about 400ms, so that's alright. But sometimes the functions take a very long time (around 8 seconds), while the entry was already added to the queue.
Note: Several of the recommendations in this document center around what is known as a cold start. Functions are stateless, and the execution environment is often initialized from scratch, which is called a cold start. Cold starts can take significant amounts of time to complete.
10 for single-document requests and query requests.
1-2 minutes is typical. Unlike some other FaaS providers, Cloud Functions is actually running npm install
and building the node_modules
in the cloud, which does take some time but also means you don't need to worry about cross-compiling native dependencies.
Cloud Functions doesn't know if you updated your function or not, so it does a fresh redeploy every time.
My recommendation is to ONLY update the functions you changed. You can do this with the following:
firebase deploy --only functions:specificFunctionName,functions:anotherFunctionName,etc
This should speed things up at least a little bit, but probably not a lot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With