I'm having trouble doing firebase deploy --only functions for an app on Blaze plan.
I have the latest firebase-tools CLI (v 3.5.0).
I get the following error:
=== Deploying to 'myapp1234'...
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 (1.29 KB) for uploading
✔ functions: functions folder uploaded successfully
i starting release process (may take several minutes)...
i functions: updating function myFunc...
⚠ functions[myFunc]: Deploy Error: Failed to initialize a region
Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
I've retried this every half hour for the past 12 hours, thinking there's an outage. The firebase status page shows all green.
Ok, here's what I found, a little weird:
firebase list shows all the firebase projects you have access to, BUT they are not already available (i.e. added as alias to your current folder project).
Even if the firebase-tools CLI allows you to do firebase deploy --project myproject1, if you do not have myproject1 declared in .firebaserc => it will fail with the weird region error above.
To fix this, I found that there are 2 options:
firebase use --add (will trigger an interactive list)
firebase use myproject1
=> and then firebase deploy --project myproject1 will work (with or without the optional --only functions)
Related
I'm using the firebase-tools CLI to deploy firebase functions. I'm trying to deploy a function using firebase deploy --only functions:functionName.
This is in an existing project. The functions are located in /functions/index.js.
Up until a few hours ago, deploying worked fine. But now when trying to deploy a new function I get the following:
i deploying functions
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
+ functions: required API cloudbuild.googleapis.com is enabled
+ functions: required API cloudfunctions.googleapis.com is enabled
i functions: preparing functions directory for uploading...
+ Deploy complete!
But it clearly does not even upload anything or deploy a function. Trying to deploy an existing function, I get The following functions are found in your project but do not exist in your local source code:
I'm a bit baffled as to how this seems to have "broken". Even looking at the git for the project there have been no changes to any config files or anything, other than writing a new function. I have not updated any packages since last deploying, and have tried the previous version of firebase-tools as well as the latest version.
Deploying a different function to a different project in the same manner is successful.
Turns out, I had created a file called functions.js in the project root directory (not /functions directory) and it appears firebase-tools was looking to that (empty) file for its functions, instead of the functions directory. Strange, and no kind of error message since I guess the file it thought it was looking for did exist.
This question already has answers here:
Is Cloud Functions in Firebase Free or Not (Cloud Functions deployment requires the pay-as-you-go (Blaze) billing plan)
(8 answers)
Closed 2 years ago.
(base) macbooks-mbp:functions macbook$ firebase deploy
=== Deploying to 'fir-project1-e0b25'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions# lint /Users/macbook/fireCast/functions
> tslint --project tsconfig.json
Running command: npm --prefix "$RESOURCE_DIR" run build
> functions# build /Users/macbook/fireCast/functions
> tsc
✔ functions: Finished running predeploy script.
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
**⚠ functions: missing required API cloudbuild.googleapis.com. Enabling now...**
✔ functions: required API cloudfunctions.googleapis.com is enabled
Error: Cloud Functions deployment requires the pay-as-you-go (Blaze) billing plan. To upgrade your project, visit the following URL:
https://console.firebase.google.com/project/fir-project1-e0b25/usage/details
For additional information about this requirement, see Firebase FAQs:
If you read the error message carefully, it tells you what you need to do:
Cloud Functions deployment requires the pay-as-you-go (Blaze) billing plan. To upgrade your project, visit the following URL:
https://console.firebase.google.com/project/fir-project1-e0b25/usage/details
Cloud Functions no longer allows you to deploy functions targeting the nodejs 10 runtime without a billing account active on the project.
See also: Is Function Cloud in Firebase Free or Not (Cloud Functions deployment requires the pay-as-you-go (Blaze) billing plan)
I have a vue project. It has a firebase function. I was able to deploy the function to google cloud once. But trying to deploy it later, I find I'm unable to.
Here is the console output from Visual Studio Code:
PS C:\udemy\vue-firebase\geo-ninjas> firebase deploy --only functions
=== Deploying to 'g-s-geo-ninjas'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
functions# lint C:\udemy\vue-firebase\geo-ninjas\functions
eslint .
functions: Finished running predeploy script.
i functions: ensuring necessary APIs are enabled...
functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (38.34 KB) for uploading
functions: functions folder uploaded successfully
i functions: updating Node.js 6 function checkAlias(us-central1)...
! functions[checkAlias(us-central1)]: Deployment error.
Error setting up the execution environment for your function. Please try > deploying again after a few minutes.
Functions deploy had errors with the following functions:
checkAlias
To try redeploying those functions, run:
firebase deploy --only functions:checkAlias
To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
PS C:\udemy\vue-firebase\geo-ninjas>
When I look at the logs in the firebase console, I see this:
{"#type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":13,"message":"INTERNAL"},"authenticationInfo":{"principalEmail":"junk.mail291276#gmail.com"},"requestMetadata":{"requestAttributes":{},"destinationAttributes":{}},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.UpdateFunction","resourceName":"projects/g-s-geo-ninjas/locations/us-central1/functions/checkAlias"}
I widdled down my checkAlias function to the bare minimum that would function:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.checkAlias = functions.https.onCall(data => {});
...and this still won't deploy.
I've ran eslint and this has no lint errors. When I run this locally, it works.
Why would I be getting these errors when trying to deploy my firebase function?
I am building an "actions on google" application with firebase hosting the node.js back-end.
First deployment was successful and provided a webhook which works fine.
After updating my .js files I run:
firebase deploy --only functions
and get the following output:
=== Deploying to 'monprogrammetele-c5169'...
i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/monprogrammetele-c5169/overview
Everything looks fine except that when I test with the simulator
https://console.actions.google.com/project/......
I still get the old version running....
The only difference I can see between the initial deploy and this one is that firebase is not providing a webhook link like it did the first time:
Function URL: https://us-central1-programmetele-82c89.cloudfunctions.net/teleProgram
I have assumed it is still the same.
The missing URL during deployment was fixed in version 3.16.0 of the CLI. Please upgrade it like this:
npm install -g firebase-tools
Issue was on my side, did some changes on index.js for local testing that were incompatible with firebase. I would suggest though that firebase is more explicit in its debugging messages.
Thanks for the help,
Thierry
I'm in the process of uploading some Cloud Functions for Firebase via the Firebase CLI. I have my functions folder setup and everything is correct. :I actually use this exact functions folder in another project but for whatever reason in this particular project, when I run firebase deploy --only functions, I get this:
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 (972 B) for uploading
✔ functions: functions folder uploaded successfully
i starting release process (may take several minutes)...
i functions: updating function getUserByEmail...
⚠ functions[getUserByEmail]: Deploy Error: Failed to initialize a region
Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
Does anyone know what this error means?
Thanks in advance!