-
Notifications
You must be signed in to change notification settings - Fork 20
production not seeing most exceptions #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Could you share the repo for me to debug? |
Unfortunately it’s not a public repo. |
That's ok. I have reproduced the issue on my end. After some initial exploration, it appears that this is "standard" Rails behavior; that is, in production Rails doesn't report exceptions to the error reporter when the errors occur within the HTTP request lifecycle. The short answer, for now, is that in production Rails renders exceptions instead of raising exceptions, and the current code only reports raised exceptions. I am trying to find someone who might know if there is any way to configure Rails to report rendered exceptions in production. There might not be such a config presently tho. If not, then I will work to open a PR to Rails to fix this major limitation of the error reporter. But, for now, there is no fix I can find. I will keep you updated here as I learn more tho. |
@holman: Can you test that this branch solves your problem? Update your Gemfile with this: gem "solid_errors", github: "fractaledmind/solid_errors", branch: "patch-executor" I don't like that I have to patch a Rails internal, but for now, that is the solution I can find. |
Pretty wild hole we're in here! I switched the branch, but strangely not seeing any difference. |
Now that is interesting, because it is working for me in production. If you get the chance to debug, you could add some manual logging to the patched Executor and see [1] if the patched Executor is being called, [2] if there is an In my case, the problem simply that Rails only reports raised exceptions, and it swallows exceptions in production to render error pages. This patch to the executor to pull out any logged exceptions (stored in the |
I just connected this conversation to the issue that I have opened in Rails. Hopefully, someone at some point will get involved there and we can start making our way to a solution in Rails itself, because to my mind this is clearly a Rails bug. An error reporter that doesn't report errors in production is just about useless. I never expected it to not work in production (and, I didn't realize that it wasn't working because I was seeing errors from background jobs and just figured there weren't any production errors occurring 😅. So thank you for bringing this to my attention) |
Hah, yeah no worries! It was pretty surprising to me, too. Will be interesting what comes out of the Rails issue; I’m subscribed there too. Unfortunately I’m heading out for a few hours, but will dig into it more on my side later today. Thanks for all the digging thus far! |
Have you looked into how Sentry works? I thought I remembered them working on changes to support Rails' new error subscriber stuff, maybe here: https://github.com/getsentry/sentry-ruby/blob/master/sentry-rails/lib/sentry/rails/railtie.rb#L51 via getsentry/sentry-ruby#1705 -- I haven't spent much time looking into this, but I noticed they have |
I dug into Honeybadger's source, but not Sentry's yet. I expect it to be similar. Honeybadger adds a middleware which pulls out the exception from the header. |
Looks like the problem (at least in my setup) is this line: ActiveSupport.on_load(:action_dispatch) do That never seems to get loaded looks like? So it doesn't end up calling the |
Right, just double checked and that is not a load hook that Rails actually calls. Just updated the code in that branch. Also going to keep digging and experimenting to see if we can make this not necessary. |
Fixed in edge Rails! |
Is rails |
Hi! Digging the project thus far; really like the idea for something more straightforward, particularly for greenfield apps! Kudos.
I've got a weird situation that for some reason I can't sort out what might be happening.
solid_errors
works well and as-intended in development, but I'm having some issues in production- namely, it's not picking up any new exceptions generated by the app.raise "boom"
in a controller doesn't get caught and inserted into the errors tablesolid_errors
does get listed as a subscriber inRails.error
If I manually trigger an exception using Rails' error API in the console, it shows up correctly:
Probably something obvious I'm missing, but just was a bit confusing since the app I'm trying it in is pretty straightforward; shouldn't be many changes from a stock
production.rb
at this point.The text was updated successfully, but these errors were encountered: