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.
Related
I'm new to kotlin and having some trouble running my Ktor server on heroku
I'm setting up the server as follows:
val port = System.getenv("PORT")?.toInt() ?: 9090
embeddedServer(Netty, port = port) {
routing {
get("/") {
call.respondText(
this::class.java.classLoader.getResource("index.html")!!.readText(),
ContentType.Text.Html
)
}
static("/static") {
resources("")
}
}
}.start(wait = true)
When running on my localhost, this responds just fine. And when running in heroku, I get the log output that tells me it did start up the server on the port heroku defines:
[main] INFO ktor.application - Responding at http://0.0.0.0:55278
But then when I try to load the heroku app from the browser, I get an error, and the heroku logs say: "Connection closed without response"
heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=melomidi.herokuapp.com request_id=e0cdaa83-eaa4-4733-a51f-947de463c433 fwd="174.246.82.169" dyno=web.1 connect=0ms service=13ms status=503 bytes=0 protocol=http
I have tried with both http and https. I have also tried loading /static/index.html directly and got the same result.
I've also tried adding a SERVER_HOST env var and using that to change the default 0.0.0.0 host to various things, like localhost, 127.0.0.1 and melomidi.herokuapp.com but those resulted in other errors where the server failed to start up.
There are no other details or additional logs being output in the heroku logs when I make the request. Just the one error line per request as displayed above.
Anyone have any suggestions? Thanks in advance!
After shuffling the order of operations around so that my static resources declaration came first, I started seeing the following error in the logs:
2022-01-08T00:19:36.616138+00:00 app[web.1]: Caused by: java.lang.NoSuchMethodError: java.nio.ByteBuffer.clear()Ljava/nio/ByteBuffer;
2022-01-08T00:19:36.616138+00:00 app[web.1]: at io.ktor.utils.io.jvm.javaio.ReadingKt$toByteReadChannel$1.invokeSuspend(Reading.kt:53)
2022-01-08T00:19:36.616138+00:00 app[web.1]: at io.ktor.utils.io.jvm.javaio.ReadingKt$toByteReadChannel$1.invoke(Reading.kt)
2022-01-08T00:19:36.616139+00:00 app[web.1]: at io.ktor.utils.io.jvm.javaio.ReadingKt$toByteReadChannel$1.invoke(Reading.kt)
2022-01-08T00:19:36.616139+00:00 app[web.1]: at io.ktor.utils.io.CoroutinesKt$launchChannel$job$1.invokeSuspend(Coroutines.kt:132)
2022-01-08T00:19:36.616139+00:00 app[web.1]: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2022-01-08T00:19:36.616139+00:00 app[web.1]: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
2022-01-08T00:19:36.616139+00:00 app[web.1]: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
2022-01-08T00:19:36.616140+00:00 app[web.1]: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
2022-01-08T00:19:36.616140+00:00 app[web.1]: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
2022-01-08T00:19:36.616140+00:00 app[web.1]: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
That got me to this post:https://youtrack.jetbrains.com/issue/KTOR-3358 where I found there is a binary compatibility issue with Ktor server 1.6.5 and jdk 1.8
I updated my jvmTarget to 11 and now it's up and running!
Strange that I only encountered the issue on heroku though when both my localhost and heroku were each using jdk 1.8 previously.
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.
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)
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'"
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!