firebase-functions icon indicating copy to clipboard operation
firebase-functions copied to clipboard

Warn log messages are being displayed as errors

Open lox opened this issue 1 year ago • 0 comments

[REQUIRED] Version info

firebase-admin 12.1.1 firebase-functions 5.0.1 node v20.5.1

[REQUIRED] Test case

It appears that in the past 48 hours warnings from firebase-functions/logger have been showing up as errors.

Deploy this http function and load it:

import { onRequest } from 'firebase-functions/v2/https'
import {
  info,
  debug,
  warn,
  error,
} from 'firebase-functions/logger'

export const testLogging = onRequest(
  {
    region: 'australia-southeast1',
  },
  async (req, res) => {
    debug('Testing debug log level')
    info('Testing info log level')
    warn('Testing warn log level')
    error('Testing error log level')

    res.status(200).send('🪵')
  }
)

Then view Google Logs Explorer and look for the warn log level message:

{
  "textPayload": "Testing warn log level",
  "insertId": "667e7fed000a90ce8ae6c9ec",
  "resource": {
    "type": "cloud_run_revision",
    "labels": {
      "revision_name": "http-testlogging-00002-qah",
      "service_name": "http-testlogging",
      "project_id": "xxx",
      "configuration_name": "http-testlogging",
      "location": "australia-southeast1"
    }
  },
  "timestamp": "2024-06-28T09:18:37.692430Z",
  "severity": "ERROR",
  "labels": {
    "instanceId": "005b708770fa60bf66093c20c8214ea75b9da59219f1c76cbfbe177450f989958c2946acb605b23f136dac9d40cb24066e36d8c9a79947567ef13ee51241fc081cf5",
    "goog-managed-by": "cloudfunctions",
    "execution_id": "yhdyeteoez7x"
  },
  "logName": "projects/xxx/logs/run.googleapis.com%2Fstderr",
  "trace": "0f01589a5a42a5fe40154bd92d849074",
  "receiveTimestamp": "2024-06-28T09:18:37.694508458Z",
  "spanId": "1624219371595579013"
}

Note the incorrect "severity": "ERROR",

[REQUIRED] Steps to reproduce

Follow the test case.

[REQUIRED] Expected behavior

Warn should present as severity: WARNING

[REQUIRED] Actual behavior

Warn is "severity": "ERROR",

Were you able to successfully deploy your functions?

Yup.

lox avatar Jun 28 '24 09:06 lox