using express app as function. my functions engines:node was set to 12. I had to upgrade node locally -- so I also updated engines:node to 16. suddenly couldn't deploy the functions, I reverted back to engines:node 12. Still can't deploy functions. Seeing this error:
Missing URI for HTTPS function in printTriggerUrls. This shouldn't happen
And a bunch of messages referring to previously deployed functions:
Could not find image for function
Extremely frustrated... tried reinstalling all the local npm packages with no luck.
The solution that finally worked was to delete all the previously deployed functions and re-deploy all the functions fresh.
Try running this command to see the logs
firebase functions:log
Related
When I use the firebase deploy command to deploy the functions, is there any way to find out the number of this latest version deployed? (and know what the current version is)?
Because to find this information on the web console (one by one) by entering each function, load the dashboard ... it consumes lots of time.
The reason for this question is: I deployed some functions yesterday. Another person uploaded older versions of the functions (without updating their git). Result? it became a mess and stopped everything!
It took me a while to discover that they implemented old versions of other functions :-{
So it would be quite simple: When executing the command for example: firebase deploy --only functions, the terminal itself could show:
functionA> (release 1)
functionB> (release 30)
#RenaudTarnec 's answer is correct. The other way that I see(not using the Firebase CLI) to get only the version number of deployed Cloud Function is adding K_REVISION environment variable in your code. The K_REVISION key is the version identifier of the function. This is the example on nodejs:
exports.helloWorld = (req, res) => {
const version = process.env.K_REVISION ;
console.log(`Running version ${version}`);
res.status(200).send(`Running version ${version}\n`)
};
when using curl it shows like this:
$ curl https://us-central1-projectname.cloudfunctions.net/helloWorld
Running version 5
The output returned five because I deployed this the function five times.
Preamble: This solution is not through the CLI. AFAIK it is not possible, through the CLI, to get the version of a deployed Cloud Function
You can find the deployed version on the Google Cloud Console, see below:
Do as follows:
Go to https://console.cloud.google.com/functions
(If necessary, switch to the desired project)
Open the "Function details" screen by clicking on the Function name
In the drop-down box you can see the Version number.
Just recently I am starting to experience an issue when trying to deploy my functions through Firebase. When running the command firebase deploy --only functions one of my four functions deploy correctly, but the other three throw this error in the firebase-tools console:
Deployment error.
Build failed: Build error details not available. Please check the logs at url to my GCP logs
When I look at the logs the error message that shows for each function that is failing is:
ERROR: build step 3 "us.gcr.io/fn-img/buildpacks/nodejs10/builder:nodejs10_20200922_20_RC00" failed: step exited with non-zero status: 46
I have searched and googled for quite a while now and I cannot find anyone reporting the same error code, having the same non-zero status returned, or having functions fail on step 3. There doesn't seem to be much for documentation on troubleshooting the errors either.
Hopefully someone here can point me in the right direction.
Thanks!
The error seems to be caused by a missing (or not accessible) file in the history/restore functionality of Firebase. Don't know the reason for this.
A workaround that worked for me was:
Remove the functions in the web console
Deploy normally > firebase deploy
Answering since I can't comment in response to xaphod, Markus's fix worked for me, thank you mate! Deleting the function means it creates a new one rather than trying to restore it, which is the failed step 3 in the build process.
In response to xaphod, I did setup a lifecycle rule for old files in the artifacts bucket, it was by far my biggest bucket in storage and was pushing the free tier limit. I set it up a bit short probably, delete 5 days after last updated time, but surprisingly didn't run into this issue until today (possibly because I usually just deploy them all whenever I update one). I removed the lifecycle rule for now, although I'd rather it not run up the storage space again, I might end up contacting support to see if there's a way to lifecycle them without deleting the most recent, not sure why it doesn't just clear out the old images on updates though.
Found the post that suggested setting up lifecycle rules, firebase storage artifacts is huge, and did some testing as well, deleted all the files in us.artifacts and deployed all my functions (got errors on all them, only deleted the function that I needed to update earlier and deployed it by itself). Doesn't cause any errors, just takes a bit longer, so I think the issue can be fixed by deleting them all or deleting nothing, probably going to set the lifecycle rule to delete immediately and deal with the increased deploy time, rather than the cost of firebase storage.
Trying to deploy firebase functions..which deploys fine after giving warning on the first try
console warning:
Functions deploy had errors with the following functions:
To try redeploying those functions, run:
firebase deploy --only functions:
To continue deploying other features (such as database), run:
firebase deploy --except functions
redeploying does not give any error in console and functions deploys without any problem
but calling the function does not show any logs in firebase console, while giving this error in chrome console
Error: Forbidden
Your client does not have permission to get URL /sampleFunc from this server.
So I contacted firebase support and there seems to be an issue with functions:
here is what they replied:
There is an ongoing issue with the deployment of new functions as they are deployed as private, please update to the latest version 8.0.0 of the CLI with the command: npm install -g firebase-tools, which it might fix the error.
Our engineering team is already working to solve this issue, however there is no tell on when this fix will be released. At the moment the only workaround for this is to manually set a function to public using Cloud Console or gcloud CLI.
Let me know if you have more questions
Cheers,
Recently found out what is Firebase and started studying it. I need Firebase functions for the server side of my project so I was trying to see how they work but unsuccessfully.
They have nice "little" collection of functions examples there. I tried to start few of them like image-maker but none of them worked for me. Image maker shows me this errors while serving the local server for it:
! functions: Failed to load functions source code. Ensure that you
have the latest SDK by running npm i --save firebase-functions inside
the functions directory.
! functions: Error from emulator.
FirebaseError: Error parsing triggers: Cannot find module
'canvas-prebuilt'
I have no idea what are they talking about. I installed everything by Firebase tutorial through firebase init.
I have:
npm -v: 5.5.1
node --version: v8.9.1
I don't know how to check for Firebase version but I guess I have the latest one since I have just installed it. How can I fix this problem and actually try the functions? Can these functions samples be outdated? Where can I find the better ones?
I am having trouble with my Meteor up, which is perfectly functional on localhost and on Modulus. When I try to deploy to a *.meteor.com instance the upload fails and I get a very cryptic error. The first line is the gist of it I guess
Error: not a tracked temp dir: /Users/valentin/.meteor/packages/velocity_core/.0.4.5.1dbi101++os.osx.x86_64+web.browser+web.cordova
I have tried installing and reinstalling velocity and tried deploying it with/without, the error persists. There are a bunch of hidden files in the folder the error points too. Deleting the one mention in the error simply creates new ones and throws an error again (naming a different folder though) Does anyone have an idea what it is about?
I had the same problem with another meteor package. It was solved after I delete everything from myapp/.meteor/local/ directory.
I think you can leave your local db there (myapp/.meteor/local/db), but I did not check if it still be working. (I've deleted all and probably it is the same as running meteor reset for your local project.)
OK, this seems to work: You have to manually downgrade the meteor version to 1.0.2.1, by editing .meteor/release and changing the version number. (There's a fix in dev, so it should be solved in a more complete fashion soon.)
Were you trying to deploy while your meteor app still ran in localhost? I faced the same problem for another package but resolved it by stopping my local meteor app first then deploy.