Rails 3 Routing Error after Redeploy - ruby-on-rails-3

I'm hosting a Rails 3 site on Heroku, and I've found that whenever I push a new release, POST requests raise a RoutingError until the user clears his cookies. I don't have any problems while developing locally; just when I push to Heroku. So you can hit the front page, but you get a RoutingError when you submit the Sign Up and Log In forms. Has anyone else seen this behavior? Any ideas how to fix it?
I really don't think the problem here is my config/routes.rb or in my controllers/views, because normally this works, but it breaks when I push a new release, at least until cookies get cleared. Could this be a protect_from_forgery issue?
If it helps, here are my logs:
2011-08-29T16:42:30+00:00 heroku[router]: POST mysite.com/signup dyno=web.1 queue=0 wait=0ms service=354ms status=200 bytes=7518
2011-08-29T16:42:30+00:00 heroku[nginx]: 128.91.71.89 - staging [29/Aug/2011:09:42:30 -0700] "POST /signup HTTP/1.1" 200 2482 "http://mysite.com/" "Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20100101 Firefox/6.0" mysite.com
2011-08-29T16:43:17+00:00 app[web.1]:
2011-08-29T16:43:17+00:00 app[web.1]:
2011-08-29T16:43:17+00:00 app[web.1]: Started POST "/signup" for 128.91.71.74 at Mon Aug 29 09:43:17 -0700 2011
2011-08-29T16:43:17+00:00 app[web.1]:
2011-08-29T16:43:17+00:00 app[web.1]: ActionController::RoutingError (No route matches "/signup"):

Well, it turns out the problem was the login & signup forms were doing a PUT, not a POST, because #user was wrongly getting set under certain weird conditions. Sorry to waste the time of anyone who bothers reading this!

Related

Omniauth issue with Heroku

I implemented omniauth to allow users to login via Twitter. Everything works smooth on my local environment. However, after pushing to Heroku I get an error. The error appears after the redirect to Twitter and after I click to authorize the app. Can anyone point me in the right direction?
Heroku logs:
2014-12-06T22:54:36.173266+00:00 app[web.1]: Started GET "/auth/twitter/callback?oauth_token=0YwVXdIdacx8lK2g31xgtYN5PJzBrthV&oauth_verifier=6gYtUY1sHAimjOPQ2P9FBWqkG4t85wf1" for 207.62.246.40 at 2014-12-06 22:54:36 +0000
2014-12-06T22:54:36.179194+00:00 app[web.1]: I, [2014-12-06T22:54:36.178840 #2] INFO -- omniauth: (twitter) Callback phase initiated.
2014-12-06T22:54:36.784626+00:00 app[web.1]: Processing by SessionsController#create as HTML
2014-12-06T22:54:36.784637+00:00 app[web.1]: Parameters: {"oauth_token"=>"0YwVXdIdacx8lK2g31xgtYN5PJzBrthV", "oauth_verifier"=>"6gYtUY1sHAimjOPQ2P9FBWqkG4t85wf1", "provider"=>"twitter"}
2014-12-06T22:54:36.801839+00:00 app[web.1]: Completed 500 Internal Server Error in 17ms
2014-12-06T22:54:36.805144+00:00 app[web.1]:
2014-12-06T22:54:36.805147+00:00 app[web.1]: NameError (undefined local variable or method `omniauth' for #<Class:0x007f88aa8b7c90>):
2014-12-06T22:54:36.805149+00:00 app[web.1]: app/models/user.rb:11:in `block in create_with_omniauth'
2014-12-06T22:54:36.805150+00:00 app[web.1]: app/models/user.rb:7:in `create_with_omniauth'
2014-12-06T22:54:36.805152+00:00 app[web.1]: app/controllers/sessions_controller.rb:4:in `create'
2014-12-06T22:54:36.805154+00:00 app[web.1]:
2014-12-06T22:54:36.805155+00:00 app[web.1]:
2014-12-06T22:54:36.808588+00:00 heroku[router]: at=info method=GET path="/auth/twitter/callback?oauth_token=0YwVXdIdacx8lK2g31xgtYN5PJzBrthV&oauth_verifier=6gYtUY1sHAimjOPQ2P9FBWqkG4t85wf1" host=www.insidertees.com request_id=c242efb5-8070-4bea-848e-b5542dcf79f1 fwd="207.62.246.40" dyno=web.1 connect=2ms service=638ms status=500 bytes=1754
Dumb mistake. Change omniauth to auth. Issue solved.

Getting rails feedback plugin to work on heroku

I am using the simple rails gem feedback_popup and I have followed all the instructions. It works fine locally but when I push to heroku it no longer sends the email with the feedback though the logs look like it should:
Started POST "/feedback_popup/messages" for 89.27.92.12 at 2013-08-30 08:59:05 +0000
2013-08-30T08:59:05.904701+00:00 app[web.1]:
2013-08-30T08:59:06.008570+00:00 app[web.1]: Sent mail to info#example.com (110ms)
2013-08-30T08:59:06.109094+00:00 app[web.1]: Processing by FeedbackPopup::MessagesController#create as JS
2013-08-30T08:59:06.209392+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"2jo/keno5XMWc1IgnyJUPBAu5vpLi4uzpHIRQrP+HeA=", "feedback_popup_message"=>{"body"=>"why doesn't this work"}, "commit"=>"Send"}
2013-08-30T08:59:06.310876+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.0.0/gems/feedback_popup-0.0.1/app/views/feedback_popup/mailer/feedback.text.erb (0.0ms)
2013-08-30T08:59:06.412572+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.0.0/gems/feedback_popup-0.0.1/app/views/feedback_popup/messages/create.js.erb (0.1ms)
2013-08-30T08:59:06.513491+00:00 app[web.1]: Completed 200 OK in 118ms (Views: 0.7ms | ActiveRecord: 0.0ms)
2013-08-30T08:59:05.899365+00:00 heroku[router]: at=info method=POST path=/feedback_popup/messages host=www.baybel.com fwd="89.27.92.12" dyno=web.1 connect=1ms service=132ms status=200 bytes=70
I am using MailChimp and that does a perfect job of sending the welcome email when people sign up. Any ideas?
It now works and I can think of two reasons:
1) Heroku didn't like that the config.mail_from was not an email address previously.
2) There were issues precompiling the assets.

Rails 3.2, Devise 2.2.3 & IE8 login issues

I've read through a ton of seemingly similar issues on SO and blogs about setting cookies to work across domains, but my issue is more specific than that. In general, my session_store for cookies works like a charm in dev and prod, across browsers and across sub-domains with the single exception of IE8, which won't let me login (it just redirects me back to the landing page again), and presumably the issue is that it won't issue a cookie.
My session_store.rb initializer is:
Xavy2::Application.config.session_store :cookie_store, :key => 'sitesession', domain: ".site.com"
Here is the output from one IE8 login attept
2013-08-19T15:50:13.352878+00:00 app[web.1]: Started GET "/users/sign_in" for 154.51.130.161 at 2013-08-19 15:50:13 +0000
2013-08-19T15:49:03.398016+00:00 heroku[router]: at=info method=POST path=/users/sign_in host=www.xavy.com fwd="84.207.252.4" dyno=web.1 connect=1ms service=1263ms status=302 bytes=86
2013-08-19T15:50:18.350332+00:00 heroku[router]: at=info method=GET path=/users/sign_in host=www.xavy.com fwd="154.51.130.161" dyno=web.1 connect=2ms service=5033ms status=200 bytes=8737
2013-08-19T15:50:29.746857+00:00 app[web.1]: Started POST "/users/sign_in" for 154.51.130.161 at 2013-08-19 15:50:29 +0000
2013-08-19T15:50:30.282263+00:00 heroku[router]: at=info method=POST path=/users/sign_in host=www.xavy.com fwd="154.51.130.161" dyno=web.1 connect=14ms service=542ms status=302 bytes=86
2013-08-19T15:50:30.409250+00:00 app[web.1]: Started GET "/" for 154.51.130.161 at 2013-08-19 15:50:30 +0000
2013-08-19T15:50:30.679531+00:00 heroku[router]: at=info method=GET path=/ host=www.xavy.com fwd="154.51.130.161" dyno=web.1 connect=3ms service=276ms status=200 bytes=9291
2 service=6ms status=200 bytes=84056
I'm not sure if that's relevant or what else someone would need to see to help me debug or resolve this issue?
Thanks.
is there an underscore in the domain? if so that's probably the issue: Internet Explorer ignores cookies on some domains (cannot read or set cookies)

Heroku Error H10 (App crashed)

My Heroku app has crashed, and all i'm getting out of the logs is Error H10 (App crashed)
2012-03-28T14:11:56+00:00 heroku[router]: Error H10 (App crashed) -> GET www.devsite.com/ dyno= queue= wait= service= status=503 bytes=
2012-03-28T14:11:56+00:00 heroku[nginx]: 109.145.58.15 - - [28/Mar/2012:14:11:56 +0000] "GET / HTTP/1.1" 503 607 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.83 Safari/535.11" www.devsite.com
Any idea how to draw more information out of heroku logs - or find out what is wrong?
I had a similar problem, every time I hit the server, I just got these 2 useless lines of output in the logs.
When I ran:
heroku restart
It ended up showing me more output that let me track down my issue (related to migrating to cedar) (the app was crashing on deploy it appears, never fully starting up, but not showing an error during the deploying process, as would usually occur).
According to their Developer documentation:
Check your app’s backtrace in the logs to find out what you need to do to fix the problem.
https://devcenter.heroku.com/articles/errors
I had similar issues and it was related to the dynos. H10 error.
Just run:
heroku restart
Fixed it for me!
Had a similar problem and the error was masked, running a rails c on heroku gave us the reason for the crash

RefineryCMS routes for Home page doesn't work

just started with RefineryCMS, sorry for newbie question. It runs fine locally and deployed luckily on Heroku Cedar stack. Created a page called Home. /pages/home responds fine.
routes.rb
root :to => 'pages#home'
and works on localhost:3000 but on Heroku it gives error.
The app is here:
http://refkocedar.herokuapp.com/home works
http://refkocedar.herokuapp.com/ does not work
How to set Home page to root on Heroku? Thanks for help!
$ heroku logs
2012-04-03T02:19:57+00:00 heroku[router]: GET refkocedar.herokuapp.com/assets/application-ddce3db0fc667014faf95d85d24c71d4.js dyno=web.1 queue=0 wait=0ms service=4ms status=304 bytes=0
2012-04-03T02:19:58+00:00 heroku[router]: GET refkocedar.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=4ms status=304 bytes=0
2012-04-03T02:19:58+00:00 app[web.1]: cache: [GET /favicon.ico] miss
2012-04-03T02:20:04+00:00 app[web.1]:
2012-04-03T02:20:04+00:00 app[web.1]:
2012-04-03T02:20:04+00:00 app[web.1]: Started GET "/" for 80.98.142.244 at 2012-04-03 02:20:04 +0000
2012-04-03T02:20:04+00:00 app[web.1]: cache: [GET /] miss
2012-04-03T02:20:04+00:00 app[web.1]: cache: [GET /] miss
2012-04-03T02:20:04+00:00 app[web.1]: cache: [GET /] miss
I was trying Refinery recently on myocal workspace and had a similar issue. Not sure what is different on heroku as I didnt try anything on it. This solution worked for me.
http://groups.google.com/group/refinery-cms/browse_thread/thread/504b72ec2f1575d5
Refinery admin page you have a option as "forward this page" under advanced options. Set "/"
Here I explain step by step how to set up your home as root_path(localhost:3000).
go to http://localhost:3000/refinery/login
1.Then Login with your username and password.
2.Click to Pages
3.click edit link which page you want to see when localhost:3000 loaded.
4.Click Advanced Options
5.Set / in Forward this page to another website or page text box. Then click Save
6.Now your home page will show on localhost:3000
What Sonu linked to from google groups is correct. You need to add the following in your routes.rb:
root :to => 'pages#home'
And then change the setting on your home page (under advanced settings) that says:
Forward this page to another website or page
and have this forwarded to /
This worked for me.
Very short answer. Under "Advanced Options", set "Forward this page to another website or page" to /
It doesn't sound like it should work, but it does.
I'd say this is almost certainly an error with your routes.rb file.
I was working through the Rails Tutorial by Michael Hartl to setup my new app and ran into this error over and over again.
Check to make sure that Heroku knows the correct root path e.g. " root 'application#hello'"