FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Error logs always show up in Cloud Error Reporting by inlined · Pull Request #1141 · firebase/firebase-functions · GitHub

Error logs always show up in Cloud Error Reporting - #1141

Merged
inlined merged 4 commits into
launch.nextfrom
inlined.error-logging
Jun 17, 2022
Merged

Error logs always show up in Cloud Error Reporting#1141
inlined merged 4 commits into
launch.nextfrom
inlined.error-logging

Conversation

inlined commented Jun 15, 2022

Copy link
Copy Markdown
Member

Fixes #954.

  1. Removed support for Node 8 and 10 unstructured logging since we no longer support those versions of Node.
  2. Wrap all logging.error messages in an Error if none of the args are an error.

(2) makes sure that we get a stack trace in the log message, which is required for the Cloud Run data plane to send the log line to Cloud Error Reporting, where it shows up in the Firebase "Health" tab.

Tested with the following sample:

import { onRequest } from 'firebase-functions/v2/https';
import * as logger from 'firebase-functions/logger';

export const func = onRequest((req, res) => {
    logger.info("This is an info log");
    logger.error("This is an error log");
    logger.info("This is an info log with an error suffix", new Error("suffix"));
    logger.error("This is an error log with an error suffix", new Error("suffix"));
    res.send("OK");
    throw new Error("This is an unhandled error");
});

Cloud error reporting recorded all logger.error lines and the unhandled exception. The case with an Error suffix did not nest errors, which would cause the stack trace to be repeated.

inlined requested review from colerogers and taeold June 15, 2022 21:48
inlined merged commit ea5edf9 into launch.next Jun 17, 2022
inlined deleted the inlined.error-logging branch June 17, 2022 20:52
taeold added this to the v4 milestone Jun 24, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL