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
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.
Related
I am using github action to deploy firebase functions with command like so:
firebase deploy --only functions --non-interactive --token ${{ secrets.FIREBASE_TOKEN }}
however currently all my triggered github action instances to firebase function deploy fail, i believe its due to the cloud build process timing out because the high count of functions building and attempting to deploy at once. In my case 50+
How exactly can i deploy firebase functions in batches using github action?
Ideally, it would read the export functions from main index.js file of functions and deploy 25 functions at a time with some delay3(i.e 30 seconds) in between.
I am aware i can do this by hardcoding function names but i was hoping to do keep the github action simple and independent of function names.
I am trying to deploy my firebase project as usual, but today I am facing an error that I couldn't find a refrence for online.
i deploying database, functions, hosting
i database: checking rules syntax...
✔ database: rules syntax for database my-project is valid
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
✔ functions: required API cloudfunctions.googleapis.com is enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (28.29 KB) for uploading
Error: Some Cloud Functions regions were unreachable, please try again later.
My functions are errors-free, I didn't change anything since they where working last time. I appreciate your kind help on that.
firebaser here
It seems there were issues deploying to some regions earlier today. The problem should now be solved, so please try again and let me know if it's still failing.
Ran into the same issue deploying from the Netherlands. Circumvented it by deploying through a VPN in New York.
When I try to run `Firebase deploy', it stucks at this line of code
i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
the firebase init and firebase login are doing fine but firebase deploy keeps stuck. My firebase version is 3.18.4 and im currently using ubuntu 17.10.
EDIT:
and after waiting for about an hour it diplays this line of code
FIREBASE WARNING: auth() was canceled: Auth token is expired.
Am I doing something wrong?. I am new to Firebase and I need some tips/ advice on why this happening
Here is a tip, that might help you. Give it a try and tell me if it resolves your issue.
Always use these commands instead of just firebase deploy
firebase deploy --only hosting
firebase deploy --only functions <<- use this in ur case. Also make sure your in the directory /functions of your project where you ran your firebase init
Sometimes Firebase services may be down, which would prevent you from deploying your code. If you can't deploy, check this site and see if at least all services are up and running: https://status.firebase.google.com/
I seem to be having issues getting my site live onto the Firebase Hosting.
I followed this tutorial: https://github.com/firebase/functions-samples/tree/master/stripe
Which has these steps:
Create a Firebase Project using the Firebase Developer Console
Enable billing on your project by switching to the Blaze or Flame plan. See pricing for more details. This is required to be able to do requests to non-Google services.
Enable Google sign on your Firebase project
Install Firebase CLI Tools if you have not already and log in with firebase login.
RESULT: Already logged in as user#gmail.com
Configure this sample to use your project using firebase use --add and select your project.
RESULT: Error: Firebase use must be run from a Firebase Directory
Run firebase init to start a project
Run firebase init
What Firebase CLI features do you want to setup for this directory?
Database
Functions
Hosting
I chose HOSTING.
Select a default Firebase project for this directory
I Chose the only project there and got:
✔ Firebase initialization complete
I Ran Firebase use --add again, chose and alias and not it says:
Now using alias stageTemp.
Install dependencies locally by running: cd functions; npm install; cd -
npm WARN stripe-functions# No repository field
npm WARN stripe-functions# No license field.
Add your Stripe API Secret Key to firebase config: firebase functions:config:set stripe.token=<YOUR STRIPE API KEY>
Optional: change your default currency firebase functions:config:set stripe.currency=GBP
Pass your Stripe publishable key to the Stripe.setPublishableKey call in public/index.html
Deploy your project using firebase deploy
When I run Firebase Deploy I get
i deploying functions
i functions: ensuring necessary APIs are enabled...
i runtimeconfig: ensuring necessary APIs are enabled...
✔ runtimeconfig: all necessary APIs are enabled
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (2.91 KB) for uploading
✔ functions: functions folder uploaded successfully
i starting release process (may take several minutes)...
i functions: updating function createStripeCharge...
i functions: updating function createStripeCustomer...
i functions: updating function addPaymentSource...
i functions: updating function cleanupUser...
✔ functions[createStripeCharge]: Successful update operation.
✔ functions[createStripeCustomer]: Successful update operation.
✔ functions[addPaymentSource]: Successful update operation.
✔ functions[cleanupUser]: Successful update operation.
✔ functions: all functions deployed successfully!
✔ Deploy complete!
Finally:
Test your Stripe integration by viewing your deployed site firebase open hosting:site
and then I get this:
Can anyone see why this is not working? I have gone through these steps several times and cannot seem to get it to work.
Much appreciated.
Questions for Firebase Devs:
1) This code on the example has: amount: parseInt(). What checks are in place to make sure that the DOM is not simply edited by the user?
2) This process saves a lot of data. Is Firebase PCI Compliant so that I am legally allowed to store this data?
3) I'm confused about the process flow of functions. Is there an editable file that is run on the cloud where I can add extra information and database interactions or email sending? - I ask this because I want to insert into the database only when payment is verified. If I code it from the front end then a user could just run that in the console or wherever and insert into my db as it will have write access. (I hope this makes sense - I basically just want my function to be able to access the database and not anyone else)
Thank you for your time, I understand that you will be terrible busy and I really appreciate your help with this.
After a month of successful deploying the functions deploy of new functions to Firebase database started to fail. The process halts at the point functions: preparing functions directory for uploading... and eventually stops when token expires. Running deploy with --debug flag does not give more info. I tried both deploying new code and reusing old functions on new DB nodes.
Could someone please give me a hint on what happens on this stage of deploy?
Is there a limit for the number of deployed functions I missed?
Upd: Problem solved by updating firebase-tools from 3.5.0 to 3.7.0