DEV Community

Cover image for Set up real-time error notifications for your Node.js applications in 15 minutes or less
Kyle Mistele
Kyle Mistele

Posted on

Set up real-time error notifications for your Node.js applications in 15 minutes or less

What happens when things go bump in the night?

What happens when your cloud-based Node.js applications run into errors that affect your users? Do you get notified? If you want your users to stay your users and not become your competitor's customers, it's crucial to have a monitoring and notification system in place. Today I'm going to show you how to set up a solution for just that in 15 minutes or less.

Cloud applications and technologies are great and afford plenty of advantages, but they have plenty of downsides too—gaining visibility into them can be difficult. I've spent endless hours hunting down errors in these types of environments, and it's not fun. I frequently found myself having to dig through dozens of logs before I could identify errors successfully—if I even detected them at all.

That's why a friend and I built—to help developers find and fix errors faster.

Today I'm going to show you how you can use to get real-time application error notifications sent straight to developers.

Getting Started

CodeLighthouse works by plugging a Node.js SDK into your code that automatically catches uncaught exceptions and unhandled promise rejections. The SDK also provides some other neat functionalities that I'll review more in-depth.

Installing the CodeLighthouse Node.js SDK

Adding our Node.js SDK to your project with NPM couldn't be easier:

npm install codelighthouse
Enter fullscreen mode Exit fullscreen mode

Getting your API Key

To get started with the SDK, you'll need to sign up for a free account at Once you sign up, you'll be redirected to your admin dashboard where you can find the organization name you signed up with and your API key:


Go ahead and note both of these down. We recommend copying/pasting the API key straight from the admin panel to avoid typing errors, and we provide a handy link right below it to do exactly that.

Configuring the SDK

Importing and configuring the SDK is super easy:

Note that your organization_name and api_key are the values you copied down earlier. You can find them in your admin panel here.

The default_email should be the email address you signed up with.

Inviting Users

We designed CodeLighthouse with the complexity of distributed agile teams in mind, so collaboration is a key design feature. You can invite additional users to your CodeLighthouse organization via the user management page. Once they accept the invitation, you can choose to send error notifications for the application to them by specifying their email address in default_email instead. Users in your organization can log in and configure their notification settings and view errors in the error feed.

Once you've got the SDK imported into your code, you have a couple of options on how to use it:

The Global Exception Handler

By default, CodeLighthouse will automatically catch all uncaught exceptions and unhandled promise rejections. Application error notifications will be sent to the user specified by the default_email configuration option. This can be you, or another user in your CodeLighthouse organization.

The global exception handler can be disabled by passing the keyword argument enable_global_handler=false to the SDK configuration.

It's important to note that this might not always behave as expected if you're using frameworks like Express.js since they often implicitly provide their own error handlers. For example, Express will catch exceptions inside of routes and handle them before they reach our global exception handler. Fortunately, we have a solution.

CodeLighthouse's Express.js integration

I personally love Express.js, and I'm not the only one - 73% of Node.js developers use it. Its overwhelming popularity made supporting it an easy call. We've made it easy to report application errors that happen inside your Express app:

Manually catching exceptions

Of course, we anticipate that many developers will already be performing exception handling in their code, but may want to send & receive notifications for those handled exceptions anyways. Our SDK provides an easy way for you to do this as well:

As the example demonstrates, you can either send notifications to the default user specified in the SDK, or to another user in your CodeLighthouse organization. You can view and invite additional users to your CodeLighthouse organization on the user management page in your dashboard.

Still want to know more?

Do you have any questions? Are you looking for tech support, support for another language, or a plan tailored specifically to your organization's needs? Check out our documentation page, reach out to us at, or visit our contact page!

I look forward to hearing what y'all think in the comments below!

Top comments (1)

haidyhussain profile image
haider shahid

I am sorry, I have been trying to access Unfortunately the page isn't accessible or doesn't exist. My believe is on the later. Did this project of yours died out or something?