npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

bugsnag-plugin-cloud-run-functions

v1.0.1

Published

Cloud Run functions support for @bugsnag/node

Downloads

6

Readme

bugsnag-plugin-cloud-run-functions

bugsnag-plugin-cloud-run-functions

A @bugsnag/js plugin for capturing errors in Cloud Run functions (ex Google Cloud Functions).

Quickstart

Install and configure @bugsnag/js, then install the CloudRunFunctions plugin using npm or yarn:

npm install @bugsnag/js bugsnag-plugin-cloud-run-functions
yarn add @bugsnag/js bugsnag-plugin-cloud-run-functions

To start Bugsnag with the Cloud Run functions, pass the plugin to Bugsnag.start:

const Bugsnag = require('@bugsnag/js')
const BugsnagPluginCloudRunFunctions = require('bugsnag-plugin-cloud-run-functions')
const functions = require('@google-cloud/function-framework')

Bugsnag.start({
  apiKey: 'YOUR_API_KEY',
  plugins: [BugsnagPluginCloudRunFunctions],
  otherOptions: value
})

Start handling errors in your Cloud Run function by wrapping your handler with Bugsnag handler identical by signature type.

HTTP function:

const bugsnagHandler = Bugsnag.getPlugin('CloudRunFunctions').createHttpHandler()

functions.http('httpFunction', bugsnagHandler((req, res) => {
  throw new Error('oops')
}))

(!) Note that the plugin is useless if you have express.js as a handler. Please use BugSnag middleware for express.js instead.

Event-driven (CloudEvent) function:

const bugsnagHandler = Bugsnag.getPlugin('CloudRunFunctions').createCloudEventHandler()

functions.cloudEvent('cloudEventFunction', bugsnagHandler((cloudEvent) => {
  throw new Error('oops')
}))

// or

functions.cloudEvent('cloudEventFunction', bugsnagHandler((cloudEvent, callback) => {
  callback(new Error('oops'))
}))

Data capture

The Bugsnag CloudRunFunctions plugin will automatically capture the function request in the "Request" tab for HTTP function and the function event metadata in the "CloudEvent" tab for Event-driven function on every error.

Session tracking

A session will be reported automatically each time your Cloud Run function is called. This behavior can be disabled using the autoTrackSessions configuration option.

Configuration

The Bugsnag CloudRunFunctions plugin can be configured by passing following options to createHandler.

flushTimeoutMs

Bugsnag will wait for events and sessions to be delivered before allowing the Cloud Run function to exit.

This option can be used to control the maximum amount of time to wait before timing out.

By default, Bugsnag will timeout after 2000 milliseconds.

const bugsnagHandler = Bugsnag.getPlugin('CloudRunFunctions').createHttpHandler({
  flushTimeoutMs: 5000
})

If a timeout does occur, Bugsnag will log a warning and events & sessions may not be delivered.

License

The Unlicense