Skip to content

googleapis/nodejs-error-reporting

Google Cloud Platform logo

release level npm version

Node.js idiomatic client for Error Reporting.

Error Reporting aggregates and displays errors produced in your running cloud services.

A comprehensive list of changes in each version may be found in the CHANGELOG.

Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.

Table of contents:

Quickstart

Before you begin

  1. Select or create a Cloud Platform project.
  2. Enable the Error Reporting API.
  3. Set up authentication with a service account so you can access the API from your local workstation.

Installing the client library

npm install @google-cloud/error-reporting

This module provides custom Error Reporting support for Node.js applications. Error Reporting is a feature of Google Cloud Platform that allows in-depth monitoring and viewing of errors reported by applications running in almost any environment.

However, note that @google-cloud/logging-winston and @google-cloud/logging-bunyan automatically integrate with the Error Reporting service for Error objects logged at severity error or higher, for applications running on Google Cloud Platform.

Thus, if you are already using Winston or Bunyan in your application, and don't need custom error reporting capabilities, you do not need to use the @google-cloud/error-reporting library directly to report errors to the Error Reporting Console.

Error Reporting overview

When Errors Are Reported

The reportMode configuration option is used to specify when errors are reported to the Error Reporting Console. It can have one of three values:

  • 'production' (default): Only report errors if the NODE_ENV environment variable is set to "production".
  • 'always': Always report errors regardless of the value of NODE_ENV.
  • 'never': Never report errors regardless of the value of NODE_ENV.

The reportMode configuration option replaces the deprecated ignoreEnvironmentCheck configuration option. If both the reportMode and ignoreEnvironmentCheck options are specified, the reportMode configuration option takes precedence.

The ignoreEnvironmentCheck option should not be used. However, if it is used, and the reportMode option is not specified, it can have the values:

  • false (default): Only report errors if the NODE_ENV environment variable is set to "production".
  • true: Always report errors regardless of the value of NODE_ENV.

Setup, Configuration, and Examples

See the documentation for setup instructions, configuration options, and examples: https://cloud.google.com/error-reporting/docs/setup/nodejs

Additional code samples can also be found here: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/main/error-reporting

The Error Reporting Node.js Client API Reference documentation also contains samples.

Supported Node.js Versions

Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js. If you are using an end-of-life version of Node.js, we recommend that you update as soon as possible to an actively supported LTS version.

Google's client libraries support legacy versions of Node.js runtimes on a best-efforts basis with the following warnings:

  • Legacy versions are not tested in continuous integration.
  • Some security patches and features cannot be backported.
  • Dependencies cannot be kept up-to-date.

Client libraries targeting some end-of-life versions of Node.js are available, and can be installed through npm dist-tags. The dist-tags follow the naming convention legacy-(version). For example, npm install @google-cloud/error-reporting@legacy-8 installs client libraries for versions compatible with Node.js 8.

Versioning

This library follows Semantic Versioning.

This library is considered to be stable. The code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with an extensive deprecation period. Issues and requests against stable libraries are addressed with the highest priority.

More Information: Google Cloud Platform Launch Stages

Contributing

Contributions welcome! See the Contributing Guide.

Please note that this README.md, the samples/README.md, and a variety of configuration files in this repository (including .nycrc and tsconfig.json) are generated from a central template. To edit one of these files, make an edit to its templates in directory.

License

Apache Version 2.0

See LICENSE

About

Node.js client for Stackdriver Error Reporting: Count, analyze and aggregate the crashes in your running cloud services.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages