Airbrake is an Error Monitoring Software, which most of us developers welcome with open arms. It basically helps you deal with Production errors, by maintaining a log for the same, capturing the exact URL, number of occurrences, the culprit file which caused the error, all in all, a complete Stack trace for you to fall back on.
It looks something like this;
What you are seeing above is a snapshot of a Resolved Error, specifically AbstractController::ActionNotFound error.
As you can see, all the information is broken down beautifully for all the help needed in Debugging. And this is just one of the tabs, there is more information for you to dig into.
For Ruby on Rails applications, you can integrate Airbrake by bundling the airbrake gem. A couple of steps that follow this process are decently summed on the GitHub page for the Gem. You can reach that page following , Airbrake GitHub page
So, coming to the errors now. How do you go about fixing them ?
You can either mute the error, that way Airbrake won’t be shouting on the top of their lungs for you to fix it. It’ll still pop up in the error list, so that you can pick it up at your convenience, so don’t worry about it getting lost in a black hole of errors.
Now comes the main thing, resolving them. By digging up in your code to determine the root cause, and fixing it at that very level.
Let’s try to analyse one.
The one you saw above, AbstractController::ActionNotFound . Let’s scrutinize this one.
After letting this error play with my sanity for some time, I was able to deduce the cause. It is the result of a bad request from the server. Somebody was trying to outsmart the application, by editing the URL of the page he/she was on at that moment, and landing upon a page from his imagination. How I got to this conclusion was by reproducing the same on my local system. I tried following the URL, by editing the host string and voila! The beast came out of his hiding place. I was greeted by Rails telling me that the Action I requested didn’t exist. This being a result of random actions of the user, was an error that couldn’t really be restricted as I didn’t have control over what the user would decide to visit!
That was when I could actually relate to the idiom, Ignorance is bliss <3
So, I added the fix for this in my airbrake.rb file, which is one of the initializer file in your project directory.
The saviour code block was ,
Done with that!
Another such beauty I came across was, SidekiqStatus::Container::StatusNotFound error.
This one was a bit tricky to debug. I had to bother my teammates and we kept scratching our heads for quite some time.
Our background jobs are handled using Sidekiq.
The fix for this was replacing that code, and calling the method explicitly every time the action was required. This was able to handle the error, and when we tried reproducing it, nothing! Hurray!
These are the two errors that I dealt with most recently, and felt the need to document it, for future reference as well as for other developers out there who may face similar kind of issues. That’s all for now.
RailsCarma combines technical prowess with in-depth industry insight to serve as a perfect partner for Startups at crafting pleasant, functional and scalable Ruby on Rails Applications. With our solution focused approach, your business gets to enjoy definitive outcomes in terms of performance.
So, do you have a great idea? Our experts would love to explore the opportunity to develop it into a successful app with you!
Ruby on Rails Developer