Lance Samaria
Lance Samaria

Reputation: 19592

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

Upvotes: 4

Views: 2890

Answers (2)

Lance Samaria
Lance Samaria

Reputation: 19592

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

Upvotes: 2

marian.vladoi
marian.vladoi

Reputation: 8066

Cloud Functions interface has changed the past years.

Not sure that has impacted the logs aggregation, but it's possible.

Redeploy your function, without code update to update it

Upvotes: 0

Related Questions