Rails 7 Update Breaking in Production on Heroku - ruby-on-rails

First post here, so bear with me...
I recently updated my Rails app to 7.0.1 (latest stable release) from 6.1.4. My test suite is still green and the deployment to Heroku succeeds. However, when trying to open the app I get the classic "We're sorry, but something went wrong message". Checking the logs, this is the output:
ErrorMessage1
ErrorMessage2
I'm still relatively new to Rails/Heroku deployments, and I'm stumped on where to look to try and fix this. The NoMethodError does not show many solutions online, any help is appreciated! Thank you in advance.

Your problem is related to an open issue about airbrake Discussion on rails repo Discussion on airbrake repo.
The issue is triggered when we use eager loading. For now, the quickest solution would be to disable eager loading and watch the issue or continue with rails 6 or temporarily stop using airbrake.
config.eager_load = false // to disable eager loading _ production.rb
[edit]
A new version of airbrake fixes this issue so that you won't need to disable eager loading in production. airbrake:13.0.0 fix.
So, you'll just need to update to the proper version in your Gemfile.

Related

How can I disable ActiveSupport::Notifications on Rails 7?

I'm trying to upgrade my API from Rails 6 to Rails 7, and got this error after solving dependences and running my app:
Error:
ActiveSupport::Notifications::InstrumentationSubscriberError (Exception(s) occurred within instrumentation subscribers: NoMethodError, NoMethodError)
I never use this feature, searching all my files doesn't exist any mention to this Notifications.
Couldn't identify who and why is calling this notifications and neither find on Rails 7 Docs how can I disable this feature to solve my problem. Anyone know how can I do it?
Tried remove completely the ahoy_matey gem that appears in traceback and change de API mode to false on config/application.rb but both doesn't work.
I expect disabling this feature can fix my problem.
I was getting this exact same error, and the listed solution didn't work for me.
My specific error was an old version of the Airbrake notifier library (v10, updating the v13 fixed it), but to track it down I looked at the error page, which included the NoMethodError error traces below the main application trace.
So if this happens to you, hopefully you won't lose two days to it like I just have. 😬
after spend few hours searching the docs of rails 7, I finally found it. Right here, where it says:
Controls behavior when parameters that are not explicitly permitted are found. The default value is :log in test and development environments.
:log to emit an ActiveSupport::Notifications.instrument event on the unpermitted_parameters.action_controller topic and log at the DEBUG level
The solution was add config.action_controller.action_on_unpermitted_parameters = false on my config/application.rb file.

Rails 6 Action Mailbox internal route not working correctly

Having issues with Rails 6 Action Mailbox. I went through all the steps on the install and it appeared I had no issues with the setup. But when I navigate to localhost:3000/rails/conductor/action_mailbox/inbound_emails I get the following error:
undefined method `new_rails_conductor_inbound_email_path' for #
Setting config.api_only = false in application.rb fixed issue for me.
For anyone else following the ActionMailbox setup guide (I encountered the same issue). From what I can see, as of today (Tues Jan 7th 2020), Conductor has not yet made it into a Rails release. There is an active pull request with recent review activity, so I would guess the documentation is just a little ahead of the code.
https://github.com/rails/rails/pull/35489

Trouble with Heroku Deployment and Interpreting Heroku Log

This is my last resort to figure this out. I've searched through stackoverflow and googled various topics, but it seems to come down to how to interpret/analyze my own Heroku log. There's so much going on that I'm not sure where to look first. I see things like eager_load and direction to files app/config/environment:rb:5 and there also seems to be issues with my Unicorn configurations and relationship associations. I've gone through my files and haven't been able to locate what my logs are referring to, up until now it's been really easy to interpret errors.
A little background: I had originally built my rails app with the default Sqlite3 settings and I have attempted to switch it to Postgres. So maybe there's some conflicts with that going on as well. I want to be able to read my Heroku Logs in the future on my own and know exactly where to look. So if someone could provide a good tutorial about reading Heroku Logs that would be great as well.
Here's where I've looked so far:
I've looked on devcenter on heroku's website, but I'm not making the connection from their instructions, to the issue in my code. I'm just a that stuck point, but have been trying to figure it out for days! I'm worried that I'm just missing something basic, which is why I haven't been able to figure this out yet.
I've also looked at association_basics.html on ruby on rails guides because I've been having some syntax issues.
I've used foreman start to see if my Procfile is working and have gotten another huge list. I've also used heroku ps, which gives me web.1 crashed
Here's the Heroku Log that's also connected to my app's github page:
https://github.com/jsmit032/seasons-app/issues/29
If any other information is required, please let me know and I'll edit my questions so hopefully this can help others as well.
2014-11-21T19:27:58.271705+00:00 app[web.1]: has_many :user, through :user_to_destinations
doesn't look right - it should be
has_many :user, through: :user_to_destinations
at /app/app/models/destination.rb:3
So I got the whole app to deploy! Turns out it was a pre-complied issue.
So I went through the guide on Heroku for pre-compiling assets in Rails 4: https://devcenter.heroku.com/articles/rails-4-asset-pipeline
I also went through the heroku guide for prepping your rails 4 app:
https://devcenter.heroku.com/articles/getting-started-with-rails4#migrate-your-database
Also went through the heroku guide for SQLite on Heroku and the Deploying Rails Applications with Unicorn guide.
Looking through the console errors on the actual site was a huge help. It's how we figured out that the assets pipeline might not be working.

What are the new Rails critical security fixes?

I got these updates from rails:
I'd like to announce that 3.2.11, 3.1.10, 3.0.19, and 2.3.15 have been released. These releases contain two extremely critical security fixes so please update IMMEDIATELY.
link
as it says it's critical. I just updated my application with rails 3.1 to 3.11 and did bundle update rails. My questions are:
What was the actual loophole in rails that has now been fixed?
As a learner I'm eager to understand what the problem was and how has it been fixed. I couldn't get anywhere about this.
Is it really a big loophole, and is there any problem for all Rails application which haven't been updated?
Here's an explanation of the hack : http://charlie.bz/blog/rails-3.2.10-remote-code-execution
And the original post by tenderlove : https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/61bkgvnSGTQ
Basically, anyone can inject XML and instantiate any kind of Ruby object using YAML ... it's complicated, but works on all apps (except the patched one of course, and Rails 1.X) and can even execute system commands ...
Anyone having Rails apps around should already have upgraded ... if not, do it NOW!

Asset pipeline broken after pushing to heroku - rails 3?

I don't know what happened differently this time - my local env is running great. And my heroku app was running great. I pushed some code, and now it seems as if the asset pipline broke in my heroku app?
/assets/all.css and /assets/application.js both product "not found" errors now.
Any ideas what could have caused this or how I might be able to fix it?
To be clear - my app was working great yesterday. I didnt change the config in regards to the asset pipeline.
As ream88 said, you need the cedar stack to use Asset Pipeline. You need to create a new heroku project with --stack cedar option and modify your gemfile a bit.
I have a blog post on the subject. You can skip the compass/bootstrap stuff if you don't need it.
For future reference this was apparently a hardware failure for the day at heroku which they notified me of the following day, via email.

Resources