Raygun4Node – Node.js provider now available

Hilary CookProvider Updates2 Comments

A lot of you have been clamouring for a Node.js provider for Raygun and I am happy to announce that an early build of it is now available and is on NPM. You can check out the source code and raise issues and submit pull requests at the GitHub repository for it, here.

You can install it using: npm install raygun

The following code shows how to create and set you API key:

After this you have some options for how you wish to use the Raygun Node provider. You can manually send errors through to Raygun as below:

If you are using domains then you can use the following code:

If you wish to add it as a global exception handler you can do the following:

Be careful with that last one as this can leave your process in an unknown state. You should know that as soon as you register the above handler then the default behaviour of Node of stopping the process will cease. Have a read of the Node documentation on this here so that you know the full story.

There is also a hook if you are using Express.js, this can be used as follows:

Here is an example error that we logged to Raygun with the Node.js provider

raygun node.js dashboard

Be sure to raise any issues or ideas on GitHub, looking forward to working more on this one.

So if you are using Node.js and want to give Raygun.io a spin, sign up now for a free trial

Happy error blasting!

Next level software intelligence across your entire stack.

2 Comments on “Raygun4Node – Node.js provider now available”

  1. Paso


    There is a typo in the domains example (it’s missing the closing ‘);’ to the error handler). Also when running it nothing gets reported in the raygun application, it still tells me to “Get Raygun integrated into your application”.

  2. Callum Gavin

    Hi Paso,

    Thanks for reporting the typo – I’ve updated the post.

    There’s a couple of things that could cause the provider to fail in sending, so if you contact us from within the dashboard (click Feedback on the left) or send an email to callum at mindscape dot co dot nz I can help you get the provider working.

Leave a Reply

Your email address will not be published. Required fields are marked *