Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloud Functions works but logs not appearing

I just added Cloud Functions to an older project that I have had for a a couple of yrs now. I get a Deployment complete! message and I get the responsea inside the Log console but the Hello World console.log statements do not appear. In the same file I added my own functions which successfully work but console.log statements are printed there. The odd thing is inside one of my newer projects the console.log statements from the same code below successfully prints.

I checked the google upkeep and everything is working fine on their end.

const functions = require('firebase-functions');

exports.helloWorld = functions.https.onRequest((request, response) => {
  functions.logger.info("Hello logs!", {structuredData: true});
  console.log("Hello Again!!!");
  response.send("Hello from Firebase!");
});

enter image description here

enter image description here

like image 253
Lance Samaria Avatar asked Sep 19 '25 04:09

Lance Samaria


1 Answers

To update to the latest version in terminal run: $ sudo npm install -g firebase-tools

I reached out to the Firebase team and this was their response:

I've read your description in detail and it seems like the issue is caused by some ingestion delay for some regions in Cloud Logging which is handled by GCP (for more details please check the GCP Dashboard).

However, a similar problem was previously reported in a Github issue, and apparently it was only happening with old versions of the Firebase CLI tools, so my recommendation is to update this command line interface to the latest version (v9.6.1) and redeploy the functions once again , this will allow to validate if the function is storing the logs correctly. Also you can try to update the npm libraries used in order to keep everything in the latest versions.

You can check your version of firebase in terminal: $ firebase --version

like image 102
Lance Samaria Avatar answered Sep 23 '25 11:09

Lance Samaria