Google Cloud Function logs showing error icon for Info log types - stackdriver

I am new to google-cloud and to stack driver logging. deployed a python script as cloud function also enabled in-built logging for python. I had set multiples logs based on the execution.
logging.info("Cloud fucntion was Triggerred on time {}".format(datetime.utcnow()))
While viewing in cloud function logs, i see many, like even the statement above, for which I have set INFO as the log level is displayed with !! icon which according to the legends should be displayed for only error types.
As I am new to this stack-driver logging, I am not sure of the reason, can anyone please explain? Thanks.

Related

Authenticating Google Cloud Storage in R Studio

I know a similar question has been asked (link), but the response didn't work for me.
TLDR: I keep running into errors when trying to authenticate Google Cloud Storage in RStudio. I'm not sure what is going wrong and would love advice.
I have downloaded both the GCS_AUTH_FILE (created a service account with service admin privileges'--downloaded the key associated with the service account) and also downloaded GAR_CLIENT_WEB_JSON by creating a OAuth 2.0 Client ID and downloading that associated JSON file.
I've tried authenticating my Google Cloud Storage in several ways and hit different errors.
Way 1-automatic setup:
gcs_setup()
Then I select any one of the options, and get the error: Error in if (file.exists(local_file)) { : argument is of length zero And that error happens no matter which of the three options I select.
Way 2 - basic, following manual setup instructions from the package:
Sys.setenv("GCS_DEFAULT_BUCKET" = "my-default-bucket",
"GCS_AUTH_FILE" = "/fullpath/to/service-auth.json")
gcs_auth()
In this case, GCS_AUTH_FILE is the file that I mentioned at the beginning of this post, and the GCS_DEFAULT_BUCKET is the name of the bucket. When I run the first line, it seems to be working (nothing goes awry and it runs just fine), but when I run gcs_auth() I get taken to a web browser page that states:
"Authorization Error
Error 400: invalid_request
Missing required parameter: client_id"
Way 3: Following the method from the post that I linked above
This way involves manually setting the .Renviron file w/ the GCS_AUTH_FILE and GAR__CLIENT_WEB_JSON locations, and then running gar_auth(). And yet again, I get the exact same error as in Way 2.
Any ideas about what could be going wrong? Thanks for your help. I wasn't sure how to put in totally reproducible code in this case, so if there is a way I should do that, please let me know.

DialogFlow "Webhook call failed. Error: UNKNOWN."

I have a DialogFlow setup using a firebase function for fulfillments.
I attempted to add two regions to .region() in my index.js file. This led to me deleting my existing firebase function (which had been running on "us-central-1") and adding two new ones for the newly added regions.
After doing so, my dialogflow setup completely fails to do fulfillments. Instead, i get "Webhook call failed. Error: UNKNOWN" with no other details. I tried removing .region() in my index.js, thereby creating a new firebase function similar to the original, but without luck.
I have also tried to add my fulfillment code directly in the inline editor, but this does not work either.
I am at a loss for what to do here. Has anyone experienced similar issues or perhaps know a fix? Please note that the setup worked completely fine prior to adding .region() and deleting the existing firebase function.
NOTE: I am getting a weird error when deploying through the inline editor: "Permission 'cloudfunctions.functions.SetIamPolicy' denied on resource '(my resource)' (or resource may not exist)."
Regarding the following error:
Permission 'cloudfunctions.functions.SetIamPolicy' denied on resource '(my resource)' (or resource may not exist).
I also encountered this when I deleted the function and tried to redeploy it.
I discovered that this occurs when the user (i.e. you) deploying the function does not have sufficient permissions to set IAM policies. In my case, the project was owned by another user whilst I had limited access. After being given owner access, although you likely only need permissions to manage IAM, the function deploys without any errors.
Although you moved the location of the function, you don't mention that you changed the URL for the webhook in Dialogflow to reflect this new location. The URL for Firebase Cloud Functions include the region where the function runs, so if you change the region, you also need to change the fulfillment URL.

Cloud Function automatically terminated

enter image description hereI saw the following error in Cloud Function logs:
Error: function terminated. Recommended action: inspect logs for
termination reason. Function invocation was interrupted.
But I'm not getting any logs in Stackdriver or in Cloud Functions for Firebase logs.
When looking at stackdriver make sure to enable all logs at the filter or use this advanced filter:
resource.type="cloud_function"
resource.labels.function_name="<function_name>"
resource.labels.region="<function_region>"
Uncaught exceptions produced by your function will appear in Stackdriver Error Reporting, but if they don't try adding a catch clause and manually write it to stdout
If for some reason you find an error that is not being logged to stackdriver you can reach out to GCP support so they can check if additional logging is available at the particular function termination occurrence.

console.debug not showing in firebase functions log

console.log("Log") shows up as an Info level log in the firebase functions log.
console.debug("Debug") does not show up at all.
I have the log viewer set to display all log levels.
Is there something I need to do to support different log levels?
This is for the fulfillment for a dialogflow application, if this matters. I would guess it doesn't but it's my only experience with firebase.
console.debug is for internal messages.
You need to use:
console.log() commands have the INFO log level.
console.info() commands have the INFO log level.
console.warn() commands have the ERROR log level.
console.error() commands have the ERROR log level.
Check the documentation.

IcCube - How to retrieve full error messages for failed Google Analytics Api Calls

When you hit the "Refresh Datatable" Button for a misconfigured datatable inside the Google Analytics Plugin the command fails with the message:
Failed to load columns for table 'My Table' due to following error: 'Google Analytics Error'
This is not very descriptive.
So, how to get the fully qualified error-message which comes from the Google Analytics API?
Is there a way inside the icCube to log the error message which comes from the Google-API?
I tried to set all log-levels to DEBUG, but it did not help.
Alternatively, does Google log these errors, so that I can view them anywhere at the developer console?
It's an error on the current icCube version, will be fixed in 6.0 RC2.
Issue 254
When you refresh the Datatable, the API-Call analytics.data.ga.get is triggered.
So you can simulate this call inside the Google APIs Explorer.
Here you just need to put in the metrics and dimensions, like you did in the IcCube IDE.
How to get the profile Id is explained here.
After hitting the Execute-Button you can now see the full error-message.
A common error is to ask for more dimensions or metrics than allowed (max. 10 metric, 7 dimensions).
Of course it would be much more convenient, if the icCube Plugin would read the error-message and print it inside the IDE or the log...

Resources