Connect Rails to Bugsink

The Rails integration reports unhandled controller exceptions with their route, HTTP request, Rails transaction, and application stack.

This guide adds the integration to an existing Rails application and triggers a deliberate controller failure. To follow along, create a Bugsink project and copy its DSN from the project setup page.

Install the SDK

Add the open-source Sentry Ruby and Rails gems to your application’s bundle. Bugsink accepts the Sentry event protocol, so the SDK can send events directly to your Bugsink project:

bundle add sentry-ruby sentry-rails

Configure your DSN

Initialize the SDK in config/initializers/sentry.rb. Reading the DSN from the environment keeps it out of source control, and Rails loads the initializer before it begins handling requests:

Sentry.init do |config|
  config.dsn = ENV.fetch("SENTRY_DSN")
end

Set SENTRY_DSN to the DSN shown by your Bugsink project when you start Rails:

export SENTRY_DSN=https://key@bugsink.example/1

Send a test error

Temporarily raise an exception in a controller action you can request. Rails does not need a Bugsink-specific call inside the action; the integration sees the unhandled exception as it leaves the controller:

unless INVENTORY.key?(params[:sku])
  raise ProductNotFound, "Product #{params[:sku]} is not in inventory"
end

Start Rails with its DSN, then request that action once:

bin/rails server
:::bash
curl http://127.0.0.1:3000/checkout/rails-missing

The exception still follows Rails’s normal error handling. In production it returns the normal 500 response while the integration reports it to Bugsink.

See the error in Bugsink

Open your Bugsink project. The new InventoryController::ProductNotFound issue contains the request and points to the controller line which raised it.

Bugsink preview

That’s it: unhandled Rails controller exceptions will now be reported to Bugsink. Remove the deliberate exception; the integration remains active for future request failures.

For handled exceptions, messages, tags, structured context, breadcrumbs, and short-lived Ruby processes, continue with the Ruby guide.