Configuration options

The bugsnag.register can accept an options object as its second parameter. The options can be a combination of any of the following:


If you use an app version to identify releases of your app you can send it to Bugsnag. When set errors will only unresolve when they re-occur in a newer appVersion.

bugsnag.register("your-api-key-here", { appVersion: "1.0.0" });


Bugsnag will automatically register for the uncaughtexception event. If you do not wish for this to happen, you can disable the functionality as part of the register call:

bugsnag.register("your-api-key-here", { autoNotify: false });


You can prevent some meta-data keys (such as passwords) from being sent to Bugsnag by listing them in the filters. This is most useful if you’re sending request data and don’t want to accidentally log a user’s password. The keys are matched with substring matching, so the default value of ["password"] also excludes things like "password_confirmation":

bugsnag.register("your-api-key-here", { filters: ["password", "creditcard"] });


You can add additional headers to the request sent to Bugsnag by specifying headers. This is most commonly useful when using the proxy option.

bugsnag.register("your-api-key-here", {
    headers: { "Proxy-Authorization": "Token dXNlcjpwYXNa" }


By default we’ll fetch the hostname using Node’s os.hostname(), but you can override this by setting the hostname:

bugsnag.register("your-api-key-here", { hostname: "" });


It is often very useful to send some extra application or user specific data along with every exception. To do this, you can set the metaData:

bugsnag.register("your-api-key-here", { metaData: {
  user: {
    username: "bob-hoskins",
    name: "Bob Hoskins",
    email: ""

You can adjust this after calling register by using the bugsnag.metaData property.


By default the notifier will notify Bugsnag of production and development exceptions. If you wish to be notified about production exceptions only, you can set the notifyReleaseStages option:

bugsnag.register("your-api-key-here", { notifyReleaseStages: ["production"] });


By default, Bugsnag will exit your application if there is an uncaught exception or an uncaught event emitter “error” event. This is in line with standard node.js behaviour. If you want to have different behaviour, then please set onUncaughtError as follows:

bugsnag.register("your-api-key-here", { onUncaughtError: function(err){
  console.error(err.stack || err);

This function is called for all errors that aren’t manually sent to bugsnag.notify. So a bugsnag.intercept call will trigger a call to onUncaughtError.


If the Bugsnag notifier is unable to locate your package.json, you can specify where to find it using packageJSON:

bugsnag.register("your-api-key-here", { packageJSON: "/path/to/package.json" });


Bugsnag can highlight stacktrace lines that are in your project, and automatically hides stacktrace lines from external libraries. If Bugsnag is not hiding external stacktrace lines, it is likely that the projectRoot is being incorrectly calculated. You can set projectRoot as part of the register call:

bugsnag.register("your-api-key-here", { projectRoot: "/path/to/root" });


You can use a proxy server by configuring a proxy url when registering with Bugsnag:

bugsnag.register("your-api-key-here", {
    proxy: ""

If you need to use an authentication scheme other than Basic Authentication with the proxy, you can include the Proxy-Authentication header or other properties using the headers option.


By default, Bugsnag looks at the NODE_ENV environment variable to see what release stage the script is running in. If that is not set, Bugsnag assumes you are running in production. If you want to override this behavior, you can set the releaseStage option:

bugsnag.register("your-api-key-here", { releaseStage: "development" });


If you want to send code snippets for each frame of the stacktrace you can enable sendCode. This asynchronously loads any file from the stacktrace, which is within the scope of the project, and sends 3 lines either side of the erroneous line of code to Bugsnag.

This works almost the same as how Bugsnag JavaScript projects handle sourcemaps - however loading the code is done on the local machine and sent over the internet with the error data:

bugsnag.register("your-api-key-here", { sendCode: true });


By default, errors will be sent to Bugsnag using SSL. To disable SSL, you can set useSSL:

bugsnag.register("your-api-key-here", { useSSL: false });