Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
View categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Node.js Behavior in Heroku
      • Troubleshooting Node.js Apps
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Working with AI
    • Heroku Inference
      • Inference API
      • Quick Start Guides
      • AI Models
      • Inference Essentials
    • Vector Database
    • Model Context Protocol
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Add-ons
  • All Add-ons
  • Raygun Crash Reporting
Raygun Crash Reporting

This add-on is operated by Raygun

Quickly diagnose errors and crashes to deliver a flawless user experience.

Raygun Crash Reporting

Last updated September 03, 2020

Table of Contents

  • Provisioning the add-on
  • Using with Rails 3.x - 4.x
  • Using with Python
  • Using with Java
  • Using with Node
  • Using Crash Reporting
  • Migrating between plans
  • Removing the add-on
  • Support
  • Additional Resources

Raygun.io is an add-on that makes finding, diagnosing and fixing errors in your software fast and easy.

Get deep insight, stack traces, environment information, intelligent notifications, trend analysis and much more. Never be in the dark about software problems again.

Raygun.io is accessible via an API and has supported client libraries for Java, Ruby, Python, Node.js, JavaScript, .Net, ColdFusion and PHP.

Provisioning the add-on

Raygun.io can be attached to a Heroku application via the CLI:

A list of all plans available can be found here.

$ heroku addons:create raygun
-----> Adding raygun to sharp-mountain-4005... done, v18 (free)

Once Raygun.io has been added a RAYGUN_APIKEY setting will be available in the app configuration and will contain the API key that can be used to submit errors to the Raygun API. This can be confirmed using the heroku config:get command.

$ heroku config:get RAYGUN_APIKEY
http://user:pass@instance.ip/resourceid

After installing Raygun.io the application should be configured to fully integrate with the add-on.

Using with Rails 3.x - 4.x

Ruby on Rails applications will need to add the following entry into their Gemfile specifying the Raygun.io client library.

gem 'raygun4ruby'

Update application dependencies with bundler.

$ bundle install

Use the generator to setup the provider.

$ rails g raygun:install your_api_key

You can use the provider for manual exception tracking as well.

require 'rubygems'
require 'raygun4ruby'

begin
  # your code here
rescue Exception => e
  Raygun.track_exception(e)
end

For more usage scenarios, see the full documentation at https://raygun.com/docs/languages/ruby.

Using with Python

The easiest way to install Raygun is using pip

$ pip install raygun4py

To automatically pick up unhandled exceptions, you can provide a callback function to sys.excepthook:

import os, sys
from raygun4py import raygunprovider

raygunSender = raygunprovider.RaygunSender(os.environ.get('RAYGUN_APIKEY'))

def handle_exception(exc_type, exc_value, exc_traceback):
    raygunSender.send_exception(exc_info=(exc_type, exc_value, exc_traceback))
    sys.__excepthook__(exc_type, exc_value, exc_traceback)

sys.excepthook = handle_exception

(a, b) = (1, 2, 3,)

If you are in a web server environment and have HTTP request details available, you can pass these and the headers to the ‘request’ parameter, as a dictionary.

For more usage scenarios, see the full documentation at https://raygun.com/docs/languages/python.

Using with Java

These instructions assume you have a Maven project with a POM file set up in Eclipse, but this is also applicable to other IDEs and environments.

  1. Open your project’s pom.xml in Eclipse. Click on Dependencies -> Add. In the pattern search box, type com.mindscapehq.
  2. Add com.mindscape.raygun4java and com.mindscapehq.core, version 1.2.1. If you are working in a web environment, get the webprovider jar too. If you wish to grab the example project, you can also get the sampleapp jar.
  3. Save your POM, and the dependencies should appear in Maven Dependencies.

If you are in a shell/text editor environment, you can run mvn install from the directory containing your project’s pom.xml. You will also need to add a dependency node for the webprovider package.

To catch all exceptions in your application, and to send them to Raygun, set up an Unhandled Exception handler. Then inside it create a RaygunClient and call Send() on it, passing in the exception. The way this is done will vary based on what framework you are using.

public void uncaughtException(Thread t, Throwable e) {
  RaygunClient client = new RaygunClient("YOUR_APP_API_KEY");
  client.Send(e);
}

Presented below is a naive example that just uses plain JSPs - this architecture is obviously not recommended. A similar method will work for raw servlets if happen to be using those.

Inside web.xml

<error-page>
  <exception-type>java.lang.Throwable</exception-type>
  <location>/error.jsp</location>
</error-page>

Inside error.jsp

<%@ page isErrorPage="true" %>
<%@ page import="mindscape.raygun4java.servlet.RaygunClient" %>

<%
RaygunClient client = new RaygunClient("YOUR_APP_API_KEY", request);

client.Send(exception);
%>

When an exception is thrown from another JSP, this page will take care of the sending.

Note: all Java dynamic web page projects must have core-1.2.1.jar, webprovider-1.2.1.jar and gson-2.1.jar on their build path.

For more usage scenarios, see the full documentation at https://raygun.com/docs/languages/java.

Using with Node

Install the module with

$ npm install raygun

You can then use it as so

var raygun = require('raygun');
var raygunClient = new raygun.Client().init({ apiKey: 'your API key' });
raygunClient.send(theError);

// For express, at the end of the middleware definitions:
app.use(raygunClient.expressHandler);

For more usage scenarios, see the full documentation at https://raygun.com/docs/languages/node-js.

Using Crash Reporting

For more information on getting the most out of using Raygun, see our Crash Reporting documentation

You can access Raygun Crash Reporting via the CLI:

$ heroku addons:open raygun
Opening raygun for sharp-mountain-4005…

or by visiting the Heroku Dashboard and selecting the application in question. Select Raygun.io from the Add-ons menu.

Migrating between plans

Use the heroku addons:upgrade command to migrate to a new plan.

$ heroku addons:upgrade raygun:newplan
-----> Upgrading raygun:newplan to sharp-mountain-4005... done, v18 ($49/mo)
       Your plan has been updated to: raygun:newplan

Removing the add-on

Raygun.io can be removed via the CLI.

This will destroy all associated data and cannot be undone!

$ heroku addons:destroy raygun
-----> Removing raygun from sharp-mountain-4005... done, v20 (free)

Support

All Raygun.io support and runtime issues should be submitted via one of the Heroku Support channels. Any non-support related issues or product feedback is welcome at the Raygun forums.

Additional Resources

  • Follow @raygunio
  • Like Raygun on Facebook
  • +1 Raygun on Google+
  • Raygun.io Blog

Keep reading

  • All Add-ons

Feedback

Log in to submit feedback.

Zara 4 Raygun Real User Monitoring

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices