fractaledmind / solid_errors

database-backed, app-internal exception tracker for Rails applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usage with rails-api

riteshnoronha opened this issue · comments

Not an issue as such, but for about documentation.

To get this working with rails api i added the following to config/environments/development.rb

  config.middleware.use ActionDispatch::Cookies
  config.middleware.use ActionDispatch::Session::CookieStore
  config.middleware.use ActionDispatch::Flash

Can you elaborate on what problems you were hitting in Solid Errors that were then fixed by telling Rails to use these middlewares?

@fractaledmind the exceptions were being logged to the DB, but when i tried loading the page, it was crashing saying flash was'nt present My app is a rails api based app, which does not have any of the view layer stuff, i however have ui enabled for graphiql using https://github.com/rmosolgo/graphiql-rails?tab=readme-ov-file#note-on-api-mode, in addition to this i had to add the above middleware. For solid error however, it was crashing on missing flash. So thats the only middleware i had to add, in addition to the ones i already had.

I have not tried this is a vanilla rails api based app.

You would need these middlewares in production as well, right? So only putting that config in development.rb will just lead to the same problems in production.

In production, we do not allow any UI access. We use solid error only for our staging and dev environments. For production we use sentry and newrelic.