Related
I was trying to test sending an e-mail from a contact form of a Rails app based at an Heroku server and I got an error saying:
We're sorry, but something went wrong. If you are the application owner check the logs for more information.
My intention was to learn how to integrate a mail server service into my Heroku account. For that, the addon used was MailGun. I even created a MailGun account with my personal e-mail to be able to check if I'm getting the e-mails or not.
After deploying the code from the Cloud9 environment to Heroku servers with the success, the only change I made in my Ruby code was the following stuff:
config/environment.rb
ActionMailer::Base.smtp_settings = {
:port => ENV['MAILGUN_SMTP_PORT'],
:address => ENV['MAILGUN_SMTP_SERVER'],
:user_name => ENV['MAILGUN_SMTP_LOGIN'],
:password => ENV['MAILGUN_SMTP_PASSWORD'],
:domain => 'blahblahblah.herokuapp.com',
:authentication => :plain,
}
ActionMailer::Base.delivery_method = :smtp
What's the problem? Any tip for a solution?
Updated Requested Info (Heroku Logs - I can't update all the logs due to restriction of characters in StackOverflow body):
iamsamuel:~/workspace/saasapp (master) $ heroku logs
2017-02-24T20:18:19.316716+00:00 app[web.1]: Content-Type: text/html;
2017-02-24T20:18:19.316717+00:00 app[web.1]: charset=UTF-8
2017-02-24T20:18:19.316718+00:00 app[web.1]: Content-Transfer-Encoding: 7bit
2017-02-24T20:18:19.316718+00:00 app[web.1]:
2017-02-24T20:18:19.316719+00:00 app[web.1]: <!DOCTYPE html>
2017-02-24T20:18:19.316719+00:00 app[web.1]: <html>
2017-02-24T20:18:19.316720+00:00 app[web.1]: <head>
2017-02-24T20:18:19.316721+00:00 app[web.1]: </head>
2017-02-24T20:18:19.316721+00:00 app[web.1]: <body>
2017-02-24T20:18:19.316722+00:00 app[web.1]: <p>
2017-02-24T20:18:19.316723+00:00 app[web.1]: You have received a message from the site's contact form, from Sam, smlmrr#outlook.com.
2017-02-24T20:18:19.316724+00:00 app[web.1]: </p>
2017-02-24T20:18:19.316724+00:00 app[web.1]: <p>
2017-02-24T20:18:19.316725+00:00 app[web.1]:
2017-02-24T20:18:19.316725+00:00 app[web.1]: </p>
2017-02-24T20:18:19.316726+00:00 app[web.1]: </body>
2017-02-24T20:18:19.316726+00:00 app[web.1]: </html>
2017-02-24T20:18:19.316886+00:00 app[web.1]: I, [2017-02-24T20:18:19.316838 #4] INFO -- : [f024cbfb-df8b-4efa-8cb1-50a6a0d7881c] Completed 500 Internal Server Error in 1166ms (ActiveRecord: 4.1ms)
2017-02-24T20:18:19.317316+00:00 app[web.1]: F, [2017-02-24T20:18:19.317273 #4] FATAL -- : [f024cbfb-df8b-4efa-8cb1-50a6a0d7881c]
2017-02-24T20:18:19.317357+00:00 app[web.1]: F, [2017-02-24T20:18:19.317318 #4] FATAL -- : [f024cbfb-df8b-4efa-8cb1-50a6a0d7881c] Net::SMTPFatalError (554 Please activate your Mailgun account. Check your inbox or log in to your control panel to resend the activation email.
2017-02-24T20:18:19.317358+00:00 app[web.1]: ):
2017-02-24T20:18:19.317396+00:00 app[web.1]: F, [2017-02-24T20:18:19.317355 #4] FATAL -- : [f024cbfb-df8b-4efa-8cb1-50a6a0d7881c]
2017-02-24T20:18:19.317435+00:00 app[web.1]: F, [2017-02-24T20:18:19.317396 #4] FATAL -- : [f024cbfb-df8b-4efa-8cb1-50a6a0d7881c] app/controllers/contacts_controller.rb:15:in `create'
2017-02-24T20:18:19.520898+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=infinite-forest-28304.herokuapp.com request_id=62153ff0-bef7-4e44-958b-447fb18e7c23 fwd="188.83.235.112" dyno=web.1 connect=0ms service=1ms status=304 bytes=48
2017-02-24T20:53:16.169251+00:00 heroku[web.1]: Idling
2017-02-24T20:53:16.169901+00:00 heroku[web.1]: State changed from up to down
2017-02-24T20:53:17.034264+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-02-24T20:53:17.078764+00:00 app[web.1]: - Gracefully stopping, waiting for requests to finish
2017-02-24T20:53:17.078952+00:00 app[web.1]: === puma shutdown: 2017-02-24 20:53:17 +0000 ===
2017-02-24T20:53:17.078957+00:00 app[web.1]: - Goodbye!
2017-02-24T20:53:17.079100+00:00 app[web.1]: Exiting
2017-02-24T20:53:17.347515+00:00 heroku[web.1]: Process exited with status 0
2017-02-24T20:57:24.680979+00:00 heroku[web.1]: Unidling
2017-02-24T20:57:24.681258+00:00 heroku[web.1]: State changed from down to starting
2017-02-24T20:57:27.221989+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 44473 -e production`
2017-02-24T20:57:30.299354+00:00 app[web.1]: => Booting Puma
2017-02-24T20:57:30.299447+00:00 app[web.1]: => Rails 5.0.0 application starting in production on http://0.0.0.0:44473
2017-02-24T20:57:30.299502+00:00 app[web.1]: => Run `rails server -h` for more startup options
2017-02-24T20:57:31.229688+00:00 app[web.1]: Puma starting in single mode...
2017-02-24T20:57:31.229714+00:00 app[web.1]: * Min threads: 5, max threads: 5
2017-02-24T20:57:31.229713+00:00 app[web.1]: * Version 3.4.0 (ruby 2.3.0-p0), codename: Owl Bowl Brawl
2017-02-24T20:57:31.229716+00:00 app[web.1]: * Environment: production
2017-02-24T20:57:31.229813+00:00 app[web.1]: * Listening on tcp://0.0.0.0:44473
2017-02-24T20:57:31.230029+00:00 app[web.1]: Use Ctrl-C to stop
2017-02-24T20:57:31.421917+00:00 heroku[web.1]: State changed from starting to up
2017-02-24T20:57:32.788592+00:00 heroku[router]: at=info method=GET path="/" host=infinite-forest-28304.herokuapp.com request_id=dedd394a-498a-464d-a669-ed19fa2fd418 fwd="188.83.235.112" dyno=web.1 connect=0ms service=58ms status=200 bytes=2753
2017-02-24T20:57:32.737531+00:00 app[web.1]: I, [2017-02-24T20:57:32.737424 #4] INFO -- : [dedd394a-498a-464d-a669-ed19fa2fd418] Started GET "/" for 188.83.235.112 at 2017-02-24 20:57:32 +0000
2017-02-24T20:57:32.740219+00:00 app[web.1]: I, [2017-02-24T20:57:32.740152 #4] INFO -- : [dedd394a-498a-464d-a669-ed19fa2fd418] Processing by PagesController#home as HTML
2017-02-24T20:57:32.752357+00:00 app[web.1]: I, [2017-02-24T20:57:32.752273 #4] INFO -- : [dedd394a-498a-464d-a669-ed19fa2fd418] Rendering pages/home.html.erb within layouts/application
2017-02-24T20:57:32.753153+00:00 app[web.1]: I, [2017-02-24T20:57:32.753082 #4] INFO -- : [dedd394a-498a-464d-a669-ed19fa2fd418] Rendered pages/home.html.erb within layouts/application (0.6ms)
2017-02-24T20:57:32.759595+00:00 app[web.1]: I, [2017-02-24T20:57:32.759524 #4] INFO -- : [dedd394a-498a-464d-a669-ed19fa2fd418] Completed 200 OK in 19ms (Views: 8.6ms | ActiveRecord: 0.0ms)
2017-02-24T20:57:32.929609+00:00 heroku[router]: at=info method=GET path="/assets/application-95163fa38446d1bb6139f870d5fb932af7fa47b347b8951923c32a4565386aa6.js" host=infinite-forest-28304.herokuapp.com request_id=80d55a95-cbe8-4982-a571-bc8850567a87 fwd="188.83.235.112" dyno=web.1 connect=0ms service=1ms status=304 bytes=48
2017-02-24T20:57:32.928158+00:00 heroku[router]: at=info method=GET path="/assets/application-5ed627eba0abe94ba4e2c255c2298f55d9bca9b4ea45ded59ba1705edc5385d0.css" host=infinite-forest-28304.herokuapp.com request_id=a9c456f3-e7cd-4d6a-865f-2c8f5efbdaa7 fwd="188.83.235.112" dyno=web.1 connect=0ms service=1ms status=304 bytes=48
2017-02-24T20:57:33.143930+00:00 heroku[router]: at=info method=GET path="/assets/font-awesome/fontawesome-webfont-2932abf996373e87fbf2e950876b1962f1b57db954a1643ea68831d9fbb74da4.woff2?v=4.6.2" host=infinite-forest-28304.herokuapp.com request_id=90d78563-eaa6-4f24-a054-5c89beada59c fwd="188.83.235.112" dyno=web.1 connect=3ms service=1ms status=304 bytes=48
2017-02-24T20:57:33.402193+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=infinite-forest-28304.herokuapp.com request_id=7c20311c-bd5a-46c3-a9d5-c6266c1f9331 fwd="188.83.235.112" dyno=web.1 connect=0ms service=1ms status=304 bytes=48
2017-02-24T20:57:50.706814+00:00 heroku[router]: at=info method=GET path="/contact-us" host=infinite-forest-28304.herokuapp.com request_id=0ec752b1-0d75-42dd-83f6-ecd127086bfb fwd="188.83.235.112" dyno=web.1 connect=0ms service=35ms status=200 bytes=4317
2017-02-24T20:57:50.651067+00:00 app[web.1]: I, [2017-02-24T20:57:50.650984 #4] INFO -- : [0ec752b1-0d75-42dd-83f6-ecd127086bfb] Started GET "/contact-us" for 188.83.235.112 at 2017-02-24 20:57:50 +0000
2017-02-24T20:57:50.652579+00:00 app[web.1]: I, [2017-02-24T20:57:50.652518 #4] INFO -- : [0ec752b1-0d75-42dd-83f6-ecd127086bfb] Processing by ContactsController#new as HTML
2017-02-24T20:57:50.669618+00:00 app[web.1]: I, [2017-02-24T20:57:50.669536 #4] INFO -- : [0ec752b1-0d75-42dd-83f6-ecd127086bfb] Rendering contacts/new.html.erb within layouts/application
2017-02-24T20:57:50.681558+00:00 app[web.1]: I, [2017-02-24T20:57:50.681481 #4] INFO -- : [0ec752b1-0d75-42dd-83f6-ecd127086bfb] Rendered contacts/new.html.erb within layouts/application (11.8ms)
2017-02-24T20:57:50.682909+00:00 app[web.1]: I, [2017-02-24T20:57:50.682846 #4] INFO -- : [0ec752b1-0d75-42dd-83f6-ecd127086bfb] Completed 200 OK in 30ms (Views: 14.0ms | ActiveRecord: 7.5ms)
2017-02-24T20:59:14.426470+00:00 app[web.1]: I, [2017-02-24T20:59:14.426395 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Started POST "/contacts" for 188.83.235.112 at 2017-02-24 20:59:14 +0000
2017-02-24T20:59:14.427281+00:00 app[web.1]: I, [2017-02-24T20:59:14.427232 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Processing by ContactsController#create as HTML
2017-02-24T20:59:14.427366+00:00 app[web.1]: I, [2017-02-24T20:59:14.427324 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Parameters: {"utf8"=>"✓", "authenticity_token"=>"MgrtXM/8aUAYPnJ2ph4eIbsqMbLR/xXMZabcKmKh4myMlp0MdLJ2dCHnh7KshXSCqAsIzGQr0SdebpJw1v0QHw==", "contact"=>{"name"=>"Jesse Pinkman", "email"=>"jp#example.com", "comments"=>"Yo Beach!"}, "commit"=>"Submit"}
2017-02-24T20:59:14.429694+00:00 app[web.1]: D, [2017-02-24T20:59:14.429641 #4] DEBUG -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] (0.9ms) BEGIN
2017-02-24T20:59:14.434537+00:00 app[web.1]: D, [2017-02-24T20:59:14.434485 #4] DEBUG -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] SQL (1.3ms) INSERT INTO "contacts" ("name", "email", "comments", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Jesse Pinkman"], ["email", "jp#example.com"], ["comments", "Yo Beach!"], ["created_at", 2017-02-24 20:59:14 UTC], ["updated_at", 2017-02-24 20:59:14 UTC]]
2017-02-24T20:59:14.436712+00:00 app[web.1]: D, [2017-02-24T20:59:14.436665 #4] DEBUG -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] (1.9ms) COMMIT
2017-02-24T20:59:14.441776+00:00 app[web.1]: I, [2017-02-24T20:59:14.441724 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Rendering contact_mailer/contact_email.html.erb
2017-02-24T20:59:14.442284+00:00 app[web.1]: I, [2017-02-24T20:59:14.442237 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Rendered contact_mailer/contact_email.html.erb (0.4ms)
2017-02-24T20:59:14.622612+00:00 app[web.1]: D, [2017-02-24T20:59:14.622518 #4] DEBUG -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] ContactMailer#contact_email: processed outbound mail in 184.5ms
2017-02-24T20:59:14.749027+00:00 heroku[router]: at=info method=POST path="/contacts" host=infinite-forest-28304.herokuapp.com request_id=606794a4-3f9b-417c-b3ca-72af4d8bafb6 fwd="188.83.235.112" dyno=web.1 connect=0ms service=304ms status=500 bytes=1669
2017-02-24T20:59:14.722589+00:00 app[web.1]: I, [2017-02-24T20:59:14.722491 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Sent mail to samuelslmoreira#hotmail.com (99.8ms)
2017-02-24T20:59:14.722632+00:00 app[web.1]: D, [2017-02-24T20:59:14.722588 #4] DEBUG -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Date: Fri, 24 Feb 2017 20:59:14 +0000
2017-02-24T20:59:14.722632+00:00 app[web.1]: From: jp#example.com
2017-02-24T20:59:14.722633+00:00 app[web.1]: To: samuelslmoreira#hotmail.com
2017-02-24T20:59:14.722633+00:00 app[web.1]: Message-ID: <58b09ea298a14_43fc0c75eb9c0103ae#71798652-2827-4935-9282-6b3ae7c47b44.mail>
2017-02-24T20:59:14.722634+00:00 app[web.1]: Subject: Contact Form Message
2017-02-24T20:59:14.722634+00:00 app[web.1]: Mime-Version: 1.0
2017-02-24T20:59:14.722635+00:00 app[web.1]: Content-Type: text/html;
2017-02-24T20:59:14.722635+00:00 app[web.1]: charset=UTF-8
2017-02-24T20:59:14.722635+00:00 app[web.1]: Content-Transfer-Encoding: 7bit
2017-02-24T20:59:14.722636+00:00 app[web.1]:
2017-02-24T20:59:14.722636+00:00 app[web.1]: <!DOCTYPE html>
2017-02-24T20:59:14.722637+00:00 app[web.1]: <html>
2017-02-24T20:59:14.722637+00:00 app[web.1]: <head>
2017-02-24T20:59:14.722637+00:00 app[web.1]: </head>
2017-02-24T20:59:14.722638+00:00 app[web.1]: <body>
2017-02-24T20:59:14.722638+00:00 app[web.1]: <p>
2017-02-24T20:59:14.722638+00:00 app[web.1]: You have received a message from the site's contact form, from Jesse Pinkman, jp#example.com.
2017-02-24T20:59:14.722639+00:00 app[web.1]: </p>
2017-02-24T20:59:14.722639+00:00 app[web.1]: <p>
2017-02-24T20:59:14.722639+00:00 app[web.1]:
2017-02-24T20:59:14.722640+00:00 app[web.1]: </p>
2017-02-24T20:59:14.722640+00:00 app[web.1]: </body>
2017-02-24T20:59:14.722640+00:00 app[web.1]: </html>
2017-02-24T20:59:14.722825+00:00 app[web.1]: I, [2017-02-24T20:59:14.722779 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Completed 500 Internal Server Error in 295ms (ActiveRecord: 4.1ms)
2017-02-24T20:59:14.723286+00:00 app[web.1]: F, [2017-02-24T20:59:14.723242 #4] FATAL -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6]
2017-02-24T20:59:14.723324+00:00 app[web.1]: F, [2017-02-24T20:59:14.723287 #4] FATAL -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Net::SMTPFatalError (554 Please activate your Mailgun account. Check your inbox or log in to your control panel to resend the activation email.
2017-02-24T20:59:14.723325+00:00 app[web.1]: ):
2017-02-24T20:59:14.723357+00:00 app[web.1]: F, [2017-02-24T20:59:14.723324 #4] FATAL -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6]
2017-02-24T20:59:14.723390+00:00 app[web.1]: F, [2017-02-24T20:59:14.723357 #4] FATAL -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] app/controllers/contacts_controller.rb:15:in `create'
iamsamuel:~/workspace/saasapp (master) $ clear
iamsamuel:~/workspace/saasapp (master) $ clear
iamsamuel:~/workspace/saasapp (master) $ heroku logs
2017-02-24T20:18:19.316723+00:00 app[web.1]: You have received a message from the site's contact form, from Sam, smlmrr#outlook.com.
2017-02-24T20:18:19.316724+00:00 app[web.1]: </p>
2017-02-24T20:18:19.316724+00:00 app[web.1]: <p>
2017-02-24T20:18:19.316725+00:00 app[web.1]:
2017-02-24T20:18:19.316725+00:00 app[web.1]: </p>
2017-02-24T20:18:19.316726+00:00 app[web.1]: </body>
2017-02-24T20:18:19.316726+00:00 app[web.1]: </html>
2017-02-24T20:18:19.316886+00:00 app[web.1]: I, [2017-02-24T20:18:19.316838 #4] INFO -- : [f024cbfb-df8b-4efa-8cb1-50a6a0d7881c] Completed 500 Internal Server Error in 1166ms (ActiveRecord: 4.1ms)
2017-02-24T20:18:19.317316+00:00 app[web.1]: F, [2017-02-24T20:18:19.317273 #4] FATAL -- : [f024cbfb-df8b-4efa-8cb1-50a6a0d7881c]
2017-02-24T20:18:19.317357+00:00 app[web.1]: F, [2017-02-24T20:18:19.317318 #4] FATAL -- : [f024cbfb-df8b-4efa-8cb1-50a6a0d7881c] Net::SMTPFatalError (554 Please activate your Mailgun account. Check your inbox or log in to your control panel to resend the activation email.
2017-02-24T20:18:19.317358+00:00 app[web.1]: ):
2017-02-24T20:18:19.317396+00:00 app[web.1]: F, [2017-02-24T20:18:19.317355 #4] FATAL -- : [f024cbfb-df8b-4efa-8cb1-50a6a0d7881c]
2017-02-24T20:18:19.317435+00:00 app[web.1]: F, [2017-02-24T20:18:19.317396 #4] FATAL -- : [f024cbfb-df8b-4efa-8cb1-50a6a0d7881c] app/controllers/contacts_controller.rb:15:in `create'
2017-02-24T20:18:19.520898+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=infinite-forest-28304.herokuapp.com request_id=62153ff0-bef7-4e44-958b-447fb18e7c23 fwd="188.83.235.112" dyno=web.1 connect=0ms service=1ms status=304 bytes=48
2017-02-24T20:53:16.169251+00:00 heroku[web.1]: Idling
2017-02-24T20:53:16.169901+00:00 heroku[web.1]: State changed from up to down
2017-02-24T20:53:17.034264+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-02-24T20:53:17.078764+00:00 app[web.1]: - Gracefully stopping, waiting for requests to finish
2017-02-24T20:53:17.078952+00:00 app[web.1]: === puma shutdown: 2017-02-24 20:53:17 +0000 ===
2017-02-24T20:53:17.078957+00:00 app[web.1]: - Goodbye!
2017-02-24T20:53:17.079100+00:00 app[web.1]: Exiting
2017-02-24T20:53:17.347515+00:00 heroku[web.1]: Process exited with status 0
2017-02-24T20:57:24.680979+00:00 heroku[web.1]: Unidling
2017-02-24T20:57:24.681258+00:00 heroku[web.1]: State changed from down to starting
2017-02-24T20:57:27.221989+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 44473 -e production`
2017-02-24T20:57:30.299354+00:00 app[web.1]: => Booting Puma
2017-02-24T20:57:30.299447+00:00 app[web.1]: => Rails 5.0.0 application starting in production on http://0.0.0.0:44473
2017-02-24T20:57:30.299502+00:00 app[web.1]: => Run `rails server -h` for more startup options
2017-02-24T20:57:31.229688+00:00 app[web.1]: Puma starting in single mode...
2017-02-24T20:57:31.229714+00:00 app[web.1]: * Min threads: 5, max threads: 5
2017-02-24T20:57:31.229713+00:00 app[web.1]: * Version 3.4.0 (ruby 2.3.0-p0), codename: Owl Bowl Brawl
2017-02-24T20:57:31.229716+00:00 app[web.1]: * Environment: production
2017-02-24T20:57:31.229813+00:00 app[web.1]: * Listening on tcp://0.0.0.0:44473
2017-02-24T20:57:31.230029+00:00 app[web.1]: Use Ctrl-C to stop
2017-02-24T20:57:31.421917+00:00 heroku[web.1]: State changed from starting to up
2017-02-24T20:57:32.788592+00:00 heroku[router]: at=info method=GET path="/" host=infinite-forest-28304.herokuapp.com request_id=dedd394a-498a-464d-a669-ed19fa2fd418 fwd="188.83.235.112" dyno=web.1 connect=0ms service=58ms status=200 bytes=2753
2017-02-24T20:57:32.737531+00:00 app[web.1]: I, [2017-02-24T20:57:32.737424 #4] INFO -- : [dedd394a-498a-464d-a669-ed19fa2fd418] Started GET "/" for 188.83.235.112 at 2017-02-24 20:57:32 +0000
2017-02-24T20:57:32.740219+00:00 app[web.1]: I, [2017-02-24T20:57:32.740152 #4] INFO -- : [dedd394a-498a-464d-a669-ed19fa2fd418] Processing by PagesController#home as HTML
2017-02-24T20:57:32.752357+00:00 app[web.1]: I, [2017-02-24T20:57:32.752273 #4] INFO -- : [dedd394a-498a-464d-a669-ed19fa2fd418] Rendering pages/home.html.erb within layouts/application
2017-02-24T20:57:32.753153+00:00 app[web.1]: I, [2017-02-24T20:57:32.753082 #4] INFO -- : [dedd394a-498a-464d-a669-ed19fa2fd418] Rendered pages/home.html.erb within layouts/application (0.6ms)
2017-02-24T20:57:32.759595+00:00 app[web.1]: I, [2017-02-24T20:57:32.759524 #4] INFO -- : [dedd394a-498a-464d-a669-ed19fa2fd418] Completed 200 OK in 19ms (Views: 8.6ms | ActiveRecord: 0.0ms)
2017-02-24T20:57:32.929609+00:00 heroku[router]: at=info method=GET path="/assets/application-95163fa38446d1bb6139f870d5fb932af7fa47b347b8951923c32a4565386aa6.js" host=infinite-forest-28304.herokuapp.com request_id=80d55a95-cbe8-4982-a571-bc8850567a87 fwd="188.83.235.112" dyno=web.1 connect=0ms service=1ms status=304 bytes=48
2017-02-24T20:57:32.928158+00:00 heroku[router]: at=info method=GET path="/assets/application-5ed627eba0abe94ba4e2c255c2298f55d9bca9b4ea45ded59ba1705edc5385d0.css" host=infinite-forest-28304.herokuapp.com request_id=a9c456f3-e7cd-4d6a-865f-2c8f5efbdaa7 fwd="188.83.235.112" dyno=web.1 connect=0ms service=1ms status=304 bytes=48
2017-02-24T20:57:33.143930+00:00 heroku[router]: at=info method=GET path="/assets/font-awesome/fontawesome-webfont-2932abf996373e87fbf2e950876b1962f1b57db954a1643ea68831d9fbb74da4.woff2?v=4.6.2" host=infinite-forest-28304.herokuapp.com request_id=90d78563-eaa6-4f24-a054-5c89beada59c fwd="188.83.235.112" dyno=web.1 connect=3ms service=1ms status=304 bytes=48
2017-02-24T20:57:33.402193+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=infinite-forest-28304.herokuapp.com request_id=7c20311c-bd5a-46c3-a9d5-c6266c1f9331 fwd="188.83.235.112" dyno=web.1 connect=0ms service=1ms status=304 bytes=48
2017-02-24T20:57:50.706814+00:00 heroku[router]: at=info method=GET path="/contact-us" host=infinite-forest-28304.herokuapp.com request_id=0ec752b1-0d75-42dd-83f6-ecd127086bfb fwd="188.83.235.112" dyno=web.1 connect=0ms service=35ms status=200 bytes=4317
2017-02-24T20:57:50.651067+00:00 app[web.1]: I, [2017-02-24T20:57:50.650984 #4] INFO -- : [0ec752b1-0d75-42dd-83f6-ecd127086bfb] Started GET "/contact-us" for 188.83.235.112 at 2017-02-24 20:57:50 +0000
2017-02-24T20:57:50.652579+00:00 app[web.1]: I, [2017-02-24T20:57:50.652518 #4] INFO -- : [0ec752b1-0d75-42dd-83f6-ecd127086bfb] Processing by ContactsController#new as HTML
2017-02-24T20:57:50.669618+00:00 app[web.1]: I, [2017-02-24T20:57:50.669536 #4] INFO -- : [0ec752b1-0d75-42dd-83f6-ecd127086bfb] Rendering contacts/new.html.erb within layouts/application
2017-02-24T20:57:50.681558+00:00 app[web.1]: I, [2017-02-24T20:57:50.681481 #4] INFO -- : [0ec752b1-0d75-42dd-83f6-ecd127086bfb] Rendered contacts/new.html.erb within layouts/application (11.8ms)
2017-02-24T20:57:50.682909+00:00 app[web.1]: I, [2017-02-24T20:57:50.682846 #4] INFO -- : [0ec752b1-0d75-42dd-83f6-ecd127086bfb] Completed 200 OK in 30ms (Views: 14.0ms | ActiveRecord: 7.5ms)
2017-02-24T20:59:14.426470+00:00 app[web.1]: I, [2017-02-24T20:59:14.426395 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Started POST "/contacts" for 188.83.235.112 at 2017-02-24 20:59:14 +0000
2017-02-24T20:59:14.427281+00:00 app[web.1]: I, [2017-02-24T20:59:14.427232 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Processing by ContactsController#create as HTML
2017-02-24T20:59:14.427366+00:00 app[web.1]: I, [2017-02-24T20:59:14.427324 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Parameters: {"utf8"=>"✓", "authenticity_token"=>"MgrtXM/8aUAYPnJ2ph4eIbsqMbLR/xXMZabcKmKh4myMlp0MdLJ2dCHnh7KshXSCqAsIzGQr0SdebpJw1v0QHw==", "contact"=>{"name"=>"Jesse Pinkman", "email"=>"jp#example.com", "comments"=>"Yo Beach!"}, "commit"=>"Submit"}
2017-02-24T20:59:14.429694+00:00 app[web.1]: D, [2017-02-24T20:59:14.429641 #4] DEBUG -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] (0.9ms) BEGIN
2017-02-24T20:59:14.434537+00:00 app[web.1]: D, [2017-02-24T20:59:14.434485 #4] DEBUG -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] SQL (1.3ms) INSERT INTO "contacts" ("name", "email", "comments", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Jesse Pinkman"], ["email", "jp#example.com"], ["comments", "Yo Beach!"], ["created_at", 2017-02-24 20:59:14 UTC], ["updated_at", 2017-02-24 20:59:14 UTC]]
2017-02-24T20:59:14.436712+00:00 app[web.1]: D, [2017-02-24T20:59:14.436665 #4] DEBUG -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] (1.9ms) COMMIT
2017-02-24T20:59:14.441776+00:00 app[web.1]: I, [2017-02-24T20:59:14.441724 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Rendering contact_mailer/contact_email.html.erb
2017-02-24T20:59:14.442284+00:00 app[web.1]: I, [2017-02-24T20:59:14.442237 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Rendered contact_mailer/contact_email.html.erb (0.4ms)
2017-02-24T20:59:14.622612+00:00 app[web.1]: D, [2017-02-24T20:59:14.622518 #4] DEBUG -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] ContactMailer#contact_email: processed outbound mail in 184.5ms
2017-02-24T20:59:14.749027+00:00 heroku[router]: at=info method=POST path="/contacts" host=infinite-forest-28304.herokuapp.com request_id=606794a4-3f9b-417c-b3ca-72af4d8bafb6 fwd="188.83.235.112" dyno=web.1 connect=0ms service=304ms status=500 bytes=1669
2017-02-24T20:59:14.722589+00:00 app[web.1]: I, [2017-02-24T20:59:14.722491 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Sent mail to samuelslmoreira#hotmail.com (99.8ms)
2017-02-24T20:59:14.722632+00:00 app[web.1]: D, [2017-02-24T20:59:14.722588 #4] DEBUG -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Date: Fri, 24 Feb 2017 20:59:14 +0000
2017-02-24T20:59:14.722632+00:00 app[web.1]: From: jp#example.com
2017-02-24T20:59:14.722633+00:00 app[web.1]: To: samuelslmoreira#hotmail.com
2017-02-24T20:59:14.722633+00:00 app[web.1]: Message-ID: <58b09ea298a14_43fc0c75eb9c0103ae#71798652-2827-4935-9282-6b3ae7c47b44.mail>
2017-02-24T20:59:14.722634+00:00 app[web.1]: Subject: Contact Form Message
2017-02-24T20:59:14.722634+00:00 app[web.1]: Mime-Version: 1.0
2017-02-24T20:59:14.722635+00:00 app[web.1]: Content-Type: text/html;
2017-02-24T20:59:14.722635+00:00 app[web.1]: charset=UTF-8
2017-02-24T20:59:14.722635+00:00 app[web.1]: Content-Transfer-Encoding: 7bit
2017-02-24T20:59:14.722636+00:00 app[web.1]:
2017-02-24T20:59:14.722636+00:00 app[web.1]: <!DOCTYPE html>
2017-02-24T20:59:14.722637+00:00 app[web.1]: <html>
2017-02-24T20:59:14.722637+00:00 app[web.1]: <head>
2017-02-24T20:59:14.722637+00:00 app[web.1]: </head>
2017-02-24T20:59:14.722638+00:00 app[web.1]: <body>
2017-02-24T20:59:14.722638+00:00 app[web.1]: <p>
2017-02-24T20:59:14.722638+00:00 app[web.1]: You have received a message from the site's contact form, from Jesse Pinkman, jp#example.com.
2017-02-24T20:59:14.722639+00:00 app[web.1]: </p>
2017-02-24T20:59:14.722639+00:00 app[web.1]: <p>
2017-02-24T20:59:14.722639+00:00 app[web.1]:
2017-02-24T20:59:14.722640+00:00 app[web.1]: </p>
2017-02-24T20:59:14.722640+00:00 app[web.1]: </body>
2017-02-24T20:59:14.722640+00:00 app[web.1]: </html>
2017-02-24T20:59:14.722825+00:00 app[web.1]: I, [2017-02-24T20:59:14.722779 #4] INFO -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Completed 500 Internal Server Error in 295ms (ActiveRecord: 4.1ms)
2017-02-24T20:59:14.723286+00:00 app[web.1]: F, [2017-02-24T20:59:14.723242 #4] FATAL -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6]
2017-02-24T20:59:14.723324+00:00 app[web.1]: F, [2017-02-24T20:59:14.723287 #4] FATAL -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] Net::SMTPFatalError (554 Please activate your Mailgun account. Check your inbox or log in to your control panel to resend the activation email.
2017-02-24T20:59:14.723325+00:00 app[web.1]: ):
2017-02-24T20:59:14.723357+00:00 app[web.1]: F, [2017-02-24T20:59:14.723324 #4] FATAL -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6]
2017-02-24T20:59:14.723390+00:00 app[web.1]: F, [2017-02-24T20:59:14.723357 #4] FATAL -- : [606794a4-3f9b-417c-b3ca-72af4d8bafb6] app/controllers/contacts_controller.rb:15:in `create'
2017-02-24T21:30:27.890702+00:00 heroku[router]: at=info method=GET path="/" host=infinite-forest-28304.herokuapp.com request_id=ef1e2185-e94e-4a90-907e-15dad519fd59 fwd="188.83.235.112" dyno=web.1 connect=1ms service=6ms status=200 bytes=2753
2017-02-24T21:30:27.866291+00:00 app[web.1]: I, [2017-02-24T21:30:27.866202 #4] INFO -- : [ef1e2185-e94e-4a90-907e-15dad519fd59] Started GET "/" for 188.83.235.112 at 2017-02-24 21:30:27 +0000
2017-02-24T21:30:27.867090+00:00 app[web.1]: I, [2017-02-24T21:30:27.867030 #4] INFO -- : [ef1e2185-e94e-4a90-907e-15dad519fd59] Processing by PagesController#home as HTML
2017-02-24T21:30:27.868034+00:00 app[web.1]: I, [2017-02-24T21:30:27.867962 #4] INFO -- : [ef1e2185-e94e-4a90-907e-15dad519fd59] Rendering pages/home.html.erb within layouts/application
2017-02-24T21:30:27.868172+00:00 app[web.1]: I, [2017-02-24T21:30:27.868117 #4] INFO -- : [ef1e2185-e94e-4a90-907e-15dad519fd59] Rendered pages/home.html.erb within layouts/application (0.0ms)
2017-02-24T21:30:27.869109+00:00 app[web.1]: I, [2017-02-24T21:30:27.869058 #4] INFO -- : [ef1e2185-e94e-4a90-907e-15dad519fd59] Completed 200 OK in 2ms (Views: 1.3ms | ActiveRecord: 0.0ms)
2017-02-24T21:30:28.039850+00:00 heroku[router]: at=info method=GET path="/assets/application-5ed627eba0abe94ba4e2c255c2298f55d9bca9b4ea45ded59ba1705edc5385d0.css" host=infinite-forest-28304.herokuapp.com request_id=f9b48384-ae99-4f9e-b035-6624ef9d2ce6 fwd="188.83.235.112" dyno=web.1 connect=0ms service=1ms status=304 bytes=48
2017-02-24T21:30:28.051038+00:00 heroku[router]: at=info method=GET path="/assets/application-95163fa38446d1bb6139f870d5fb932af7fa47b347b8951923c32a4565386aa6.js" host=infinite-forest-28304.herokuapp.com request_id=7b1f62bf-5aca-4ac1-b926-5c3219b3ccac fwd="188.83.235.112" dyno=web.1 connect=1ms service=2ms status=304 bytes=48
2017-02-24T21:30:28.279062+00:00 heroku[router]: at=info method=GET path="/assets/font-awesome/fontawesome-webfont-2932abf996373e87fbf2e950876b1962f1b57db954a1643ea68831d9fbb74da4.woff2?v=4.6.2" host=infinite-forest-28304.herokuapp.com request_id=d1522ce1-c16b-4525-aa55-08c6f45713c8 fwd="188.83.235.112" dyno=web.1 connect=0ms service=1ms status=304 bytes=48
2017-02-24T21:30:29.186402+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=infinite-forest-28304.herokuapp.com request_id=1cec8754-06b9-4b20-ad32-77976a359e33 fwd="188.83.235.112" dyno=web.1 connect=0ms service=1ms status=304 bytes=48
Read the error message:
Net::SMTPFatalError (554 Please activate your Mailgun account. Check your inbox or log in to your control panel to resend the activation email.
Just activate your account.
Ok. As the logs say and as #GrahamSlick already answered, your mailgun account is not verified. If you claim that the account is verified make sure that the credentials you used in
your config/environment.rb are the correct ones that belong to the verified account and ensure that heroku uses the correct credentials. The logs say that your account is not verified. May be you want to check your settings with mailgun again and see whether they tell you something about having an inactive account. Good luck.
You have to add a domain, verified it then you can send mails from mailgun.
I ran into the exact same issue. I even tried with just CURL to make sure it had nothing to do with rails or heroku. I double checked that my domain was validated.
I ended up opening a support ticket. They got back to me within a few hours and said "now its good to go" and sure enough it works.
So it's either bugs on their end, or they purposefully require manual oversight for some accounts. Not a great first impression, but it's good to see their support responded quickly.
I'm using wicked_pdf, working fine. However, the server seems to render/execute wicked twice for only one call, resulting in one pdf-file. Can anyone tell me why? The server log looks like this:
2016-03-16T21:53:11.659341+00:00 app[web.1]: Started GET "/wpdf" for 99.99.99.99 at 2016-03-16 21:53:11 +0000
2016-03-16T21:53:11.661184+00:00 app[web.1]: Processing by SomeStoriesController#wpdf as HTML
2016-03-16T21:53:11.661632+00:00 app[web.1]: ***************WICKED***************
2016-03-16T21:53:11.663620+00:00 app[web.1]: Rendered some_stories/wpdf.html.erb (1.1ms)
2016-03-16T21:53:13.128754+00:00 heroku[router]: at=info method=GET path="/wpdf" host=xxxx.herokuapp.com request_id=3ca3a32a-2c40-4052-b7fb-8d333b7277c6 fwd="99.99.99" dyno=web.1 connect=0ms service=1477ms status=200 bytes=18490
2016-03-16T21:53:13.132369+00:00 app[web.1]: Rendered text template (0.0ms)
2016-03-16T21:53:13.132480+00:00 app[web.1]: Sent data file_name.pdf (0.5ms)
2016-03-16T21:53:13.132673+00:00 app[web.1]: Completed 200 OK in 1471ms (Views: 0.4ms | ActiveRecord: 0.0ms)
2016-03-16T21:53:13.362617+00:00 app[web.1]: Started GET "/wpdf" for 99.99.99.99 at 2016-03-16 21:53:13 +0000
2016-03-16T21:53:13.363827+00:00 app[web.1]: Processing by SomeStoriesController#wpdf as HTML
2016-03-16T21:53:13.364250+00:00 app[web.1]: ***************WICKED***************
2016-03-16T21:53:13.365987+00:00 app[web.1]: Rendered some_stories/wpdf.html.erb (1.1ms)
2016-03-16T21:53:14.468550+00:00 heroku[router]: at=info method=GET path="/wpdf" host=xxxx.herokuapp.com request_id=5b70cf38-bc29-45fd-8287-3a01b0b1372a fwd="99.99.99.99" dyno=web.1 connect=0ms service=1114ms status=200 bytes=18490
2016-03-16T21:53:14.472015+00:00 app[web.1]: Rendered text template (0.0ms)
2016-03-16T21:53:14.472110+00:00 app[web.1]: Sent data file_name.pdf (0.4ms)
2016-03-16T21:53:14.472271+00:00 app[web.1]: Completed 200 OK in 1108ms (Views: 0.3ms | ActiveRecord: 0.0ms)
I am also experiencing the same issue. It is only occurring in Chrome and is not happening in Firefox or IE.
Looks like a bug in Chrome - Chrome sends two requests when downloading a PDF (and cancels one of them)
Looks like it will be fixed in v54 of Chrome.
I'm trying to submit form data from a Titanium Mobile App to a Ruby on Rails Web App. It is a POST multipart request which includes basic data and an image.
I will show the different ways I've tried to submit the data, and the errors I get from the RoR log.
Some details:
The image for problem[avatar] comes from the phone camera.
The following code is common for all snippets below. It comes before the
snippets.
Common Code
var url = "http://some_RoR_app.herokuapp.com/problems";
var client = Ti.Network.createHTTPClient({
// function called when the response data is available
onload : function(e) {
alert('success');
},
// function called when an error occurs, including a timeout
onerror : function(e) {
alert('error');
},
timeout : 60 * 1000
});
Way #1
Titanium
I have saved the form data inside a variable, and then passed on that variable to the send() function.
var params = {
'problem[avatar]': $.report_image_view.reportPhoto.toImage(), // returns a [Ti.Blob] object
'problem[title]': $.report_title_view.title.value,
'problem[description]': $.report_description_view.description.value,
'problem[ptype]': $.report_type_view.report_type.value['valueID'],
'problem[status]': 1,
'problem[priority]': 2,
'problem[latitude]': latitude,
'problem[longitude]': longitude,
'problem[user_id]': 2
}
// Prepare the connection.
client.open("POST", url);
client.send(params);
RoR Log
013-09-04T18:30:54.048412+00:00 app[web.1]: Started POST "/problems" for 111.222.333.444 at 2013-09-04 18:30:54 +0000
2013-09-04T18:30:54.248656+00:00 app[web.1]: Processing by ProblemsController#create as MULTIPART_FORM
2013-09-04T18:30:54.248656+00:00 app[web.1]: [paperclip] Saving attachments.
2013-09-04T18:30:54.248656+00:00 app[web.1]: Redirected to https://km7.herokuapp.com/problems/32
2013-09-04T18:30:54.248656+00:00 app[web.1]: Completed 302 Found in 194ms (ActiveRecord: 80.2ms)
2013-09-04T18:30:54.252433+00:00 heroku[router]: at=info method=POST path=/problems host=some_RoR_app.herokuapp.com fwd="111.222.333.444" dyno=web.1 connect=2ms service=208ms status=302 bytes=103
2013-09-04T18:30:55.157538+00:00 app[web.1]: Started POST "/problems/32" for 111.222.333.444 at 2013-09-04 18:30:55 +0000
Result
The post is done, but not as intended. A new record is added to the database, but it is empty. In other words, the image is not uploaded, the title is empty, and so is the description, coordinates, and everything else. Only the timestamp and (object) id are set.
Way #2
Titanium
What I have done is, instead of saving the form data inside a variable, and the passing on that variable, I've created the object with the form data as the parameter to pass to the function.
client.open("POST", url);
client.send({
"problem[avatar]" : $.report_image_view.reportPhoto.toImage(), // returns a [Ti.Blob] object
"problem[title]" : $.report_title_view.title.value,
"problem[description]" : $.report_description_view.description.value,
"problem[ptype]" : $.report_type_view.report_type["valueId"],
"problem[status]" : 1,
"problem[priority]" : 2,
"problem[latitude]" : latitude,
"problem[longitude]" : longitude,
"problem[user_id]" : 2
});
RoR Log
2013-09-04T18:48:48.328758+00:00 app[web.1]: Started POST "/problems" for 111.222.333.444 at 2013-09-04 18:48:48 +0000
2013-09-04T18:48:48.635395+00:00 app[web.1]: Processing by ProblemsController#create as MULTIPART_FORM
2013-09-04T18:48:48.635395+00:00 app[web.1]: [paperclip] Saving attachments.
2013-09-04T18:48:48.635395+00:00 app[web.1]: Redirected to https://km7.herokuapp.com/problems/34
2013-09-04T18:48:48.635395+00:00 app[web.1]: Completed 302 Found in 299ms (ActiveRecord: 66.1ms)
2013-09-04T18:48:48.644302+00:00 heroku[router]: at=info method=POST path=/problems host=some_RoR_app.herokuapp.com fwd="111.222.333.444" dyno=web.1 connect=2ms service=325ms status=302 bytes=103
Result
Exactly as before. The post is done, but not as intended. A new record is added to the database, but it is empty.
Way #3
Titanium
This time I am passing a string with the parameters passed as if it is a GET. However, I cannot pass the image in this way...or can I?
var post_data = "problem[title]=Report rest client&problem[latitude]=18.09&problem[longitude]=-67.12&problem[ptype]=1&problem[status]=1&problem[priority]=2&problem[description]=Test description from rest client&problem[user_id]=2&problem[address]=123 Main Street, PR";
// Prepare the connection.
client.open("POST", url);
client.send(post_data);
RoR Log
I don't know why but it keeps redirecting me to /problems over and over until it gives up.
2013-09-04T19:03:30.982008+00:00 heroku[router]: at=info method=POST path=/problems host=some_RoR_app.herokuapp.com fwd="111.222.333.444" dyno=web.1 connect=2ms service=10ms status=307 bytes=0
2013-09-04T19:03:36.415999+00:00 app[web.1]: Started POST "/problems" for 111.222.333.444 at 2013-09-04 19:03:36 +0000
2013-09-04T19:03:36.475568+00:00 heroku[router]: at=info method=POST path=/problems host=some_RoR_app.herokuapp.com fwd="111.222.333.444" dyno=web.1 connect=1ms service=64ms status=302 bytes=100
2013-09-04T19:03:36.476626+00:00 app[web.1]: Processing by ProblemsController#create as JS
2013-09-04T19:03:36.476626+00:00 app[web.1]: Parameters: {"problem"=>{"title"=>"Report rest client", "latitude"=>"18.09", "longitude"=>"-67.12", "ptype"=>"1", "status"=>"1", "priority"=>"2", "description"=>"Test description from rest client", "user_id"=>"2", "address"=>"Calle 3, Bo. Coto Sur"}}
2013-09-04T19:03:36.476626+00:00 app[web.1]: Redirected to https://some_RoR_app.herokuapp.com/problems
2013-09-04T19:03:36.476626+00:00 app[web.1]: Completed 302 Found in 54ms (ActiveRecord: 26.1ms)
2013-09-04T19:03:37.428602+00:00 app[web.1]: Started POST "/problems" for 111.222.333.444 at 2013-09-04 19:03:37 +0000
2013-09-04T19:03:37.532547+00:00 app[web.1]: Processing by ProblemsController#create as JS
2013-09-04T19:03:37.532547+00:00 app[web.1]: Parameters: {"problem"=>{"title"=>"Report rest client", "latitude"=>"18.09", "longitude"=>"-67.12", "ptype"=>"1", "status"=>"1", "priority"=>"2", "description"=>"Test description from rest client", "user_id"=>"2", "address"=>"Calle 3, Bo. Coto Sur"}}
2013-09-04T19:03:37.532547+00:00 app[web.1]: Redirected to https://some_RoR_app.herokuapp.com/problems
2013-09-04T19:03:37.532547+00:00 app[web.1]: Completed 302 Found in 92ms (ActiveRecord: 61.0ms)
2013-09-04T19:03:38.457108+00:00 heroku[router]: at=info method=POST path=/problems host=some_RoR_app.herokuapp.com fwd="111.222.333.444" dyno=web.1 connect=2ms service=84ms status=302 bytes=100
2013-09-04T19:03:38.378766+00:00 app[web.1]: Started POST "/problems" for 111.222.333.444 at 2013-09-04 19:03:38 +0000
2013-09-04T19:03:38.455542+00:00 app[web.1]: Processing by ProblemsController#create as JS
2013-09-04T19:03:38.455542+00:00 app[web.1]: Parameters: {"problem"=>{"title"=>"Report rest client", "latitude"=>"18.09", "longitude"=>"-67.12", "ptype"=>"1", "status"=>"1", "priority"=>"2", "description"=>"Test description from rest client", "user_id"=>"2", "address"=>"Calle 3, Bo. Coto Sur"}}
2013-09-04T19:03:38.455542+00:00 app[web.1]: Redirected to https://some_RoR_app.herokuapp.com/problems
2013-09-04T19:03:38.455542+00:00 app[web.1]: Completed 302 Found in 67ms (ActiveRecord: 48.9ms)
2013-09-04T19:03:39.319540+00:00 app[web.1]: Started POST "/problems" for 111.222.333.444 at 2013-09-04 19:03:39 +0000
2013-09-04T19:03:39.361228+00:00 app[web.1]: Processing by ProblemsController#create as JS
2013-09-04T19:03:39.361228+00:00 app[web.1]: Parameters: {"problem"=>{"title"=>"Report rest client", "latitude"=>"18.09", "longitude"=>"-67.12", "ptype"=>"1", "status"=>"1", "priority"=>"2", "description"=>"Test description from rest client", "user_id"=>"2", "address"=>"Calle 3, Bo. Coto Sur"}}
2013-09-04T19:03:39.361228+00:00 app[web.1]: Redirected to https://some_RoR_app.herokuapp.com/problems
2013-09-04T19:03:39.361228+00:00 app[web.1]: Completed 302 Found in 38ms (ActiveRecord: 22.6ms)
2013-09-04T19:03:39.630525+00:00 app[web.1]: Started POST "/problems" for 111.222.333.444 at 2013-09-04 19:03:39 +0000
2013-09-04T19:03:39.731993+00:00 app[web.1]: Processing by ProblemsController#create as JS
2013-09-04T19:03:39.731993+00:00 app[web.1]: Parameters: {"problem"=>{"title"=>"Report rest client", "latitude"=>"18.09", "longitude"=>"-67.12", "ptype"=>"1", "status"=>"1", "priority"=>"2", "description"=>"Test description from rest client", "user_id"=>"2", "address"=>"Calle 3, Bo. Coto Sur"}}
2013-09-04T19:03:39.731993+00:00 app[web.1]: Redirected to https://some_RoR_app.herokuapp.com/problems
2013-09-04T19:03:39.731993+00:00 app[web.1]: Completed 302 Found in 84ms (ActiveRecord: 37.1ms)
2013-09-04T19:03:39.741297+00:00 heroku[router]: at=info method=POST path=/problems host=some_RoR_app.herokuapp.com fwd="111.222.333.444" dyno=web.1 connect=2ms service=117ms status=302 bytes=100
Result
I don't see any changes in the database. Nothing is saved.
Way #4
Titanium
This time I organize the params object in a different way. Otherwise, it is similar to Way #1
var params =
{ problem : {
avatar : $.report_image_view.reportPhoto.toImage(),
title : $.report_title_view.title.value,
description : $.report_description_view.description.value,
ptype : $.report_type_view.report_type.value['valueID'],
status : 1,
priority : 2,
latitude : latitude,
longitude : longitude,
user_id : 2
}}
// Prepare the connection.
client.open("POST", url);
client.send(params);
RoR Log
2013-09-04T19:19:38.381670+00:00 heroku[router]: at=info method=POST path=/problems host=some_RoR_app.herokuapp.com fwd="111.222.333.444" dyno=web.1 connect=4ms service=11ms status=307 bytes=0
2013-09-04T19:19:41.117687+00:00 app[web.1]: Started POST "/problems" for 111.222.333.444 at 2013-09-04 19:19:41 +0000
2013-09-04T19:19:41.162099+00:00 app[web.1]: NoMethodError (undefined method `stringify_keys' for #<String:0x00000003672638>):
2013-09-04T19:19:41.162099+00:00 app[web.1]: app/controllers/problems_controller.rb:29:in `new'
2013-09-04T19:19:41.162099+00:00 app[web.1]: app/controllers/problems_controller.rb:29:in `create'
2013-09-04T19:19:41.162099+00:00 app[web.1]:
2013-09-04T19:19:41.162099+00:00 app[web.1]:
2013-09-04T19:19:41.162726+00:00 app[web.1]: Processing by ProblemsController#create as URL_ENCODED_FORM
2013-09-04T19:19:41.162726+00:00 app[web.1]: Parameters: {"problem"=>"{\n avatar = \"[object TiBlob]\";\n description = \"Enter a description\";\n latitude = \"37.33159255981445\";\n longitude = \"-122.0305099487305\";\n priority = 2;\n status = 1;\n title = \"A test title\";\n \"user_id\" = 2;\n}"}
2013-09-04T19:19:41.162726+00:00 app[web.1]: Completed 500 Internal Server Error in 39ms
2013-09-04T19:19:41.164682+00:00 heroku[router]: at=info method=POST path=/problems host=some_RoR_app.herokuapp.com fwd="111.222.333.444" dyno=web.1 connect=2ms service=50ms status=500 bytes=643
Result
Nothing was saved in the database. However, this time it explicitly produced a NoMethodError in the new and create methods of the Problems controller.
Way #5
Titanium
This time I'm creating the object as in Way #4 but passing it directly to the send() method as a parameter, as in Way #3.
// Prepare the connection.
client.open("POST", url);
client.send({
problem : {
avatar : $.report_image_view.reportPhoto.toImage(),
title : $.report_title_view.title.value,
description : $.report_description_view.description.value,
ptype : $.report_type_view.report_type.value['valueID'],
status : 1,
priority : 2,
latitude : latitude,
longitude : longitude,
user_id : 2
}});
RoR Log
2013-09-04T20:16:36.865831+00:00 heroku[router]: at=info method=POST path=/problems host=some_RoR_app.herokuapp.com fwd="111.222.333.444" dyno=web.1 connect=2ms service=3ms status=307 bytes=0
2013-09-04T20:16:38.772048+00:00 app[web.1]: Started POST "/problems" for 111.222.333.444 at 2013-09-04 20:16:38 +0000
2013-09-04T20:16:38.808102+00:00 app[web.1]: NoMethodError (undefined method `stringify_keys' for #<String:0x00000005d45f58>):
2013-09-04T20:16:38.808102+00:00 app[web.1]: app/controllers/problems_controller.rb:29:in `new'
2013-09-04T20:16:38.808102+00:00 app[web.1]: app/controllers/problems_controller.rb:29:in `create'
2013-09-04T20:16:38.808102+00:00 app[web.1]:
2013-09-04T20:16:38.808102+00:00 app[web.1]:
2013-09-04T20:16:38.808786+00:00 app[web.1]: Processing by ProblemsController#create as URL_ENCODED_FORM
2013-09-04T20:16:38.808786+00:00 app[web.1]: Parameters: {"problem"=>"{\n avatar = \"[object TiBlob]\";\n description = \"Fix it asap.\";\n latitude = \"37.33069610595703\";\n longitude = \"-122.0306701660156\";\n priority = 2;\n status = 1;\n title = \"A broken water pipe\";\n \"user_id\" = 2;\n}"}
2013-09-04T20:16:38.808786+00:00 app[web.1]: Completed 500 Internal Server Error in 30ms
2013-09-04T20:16:38.809384+00:00 heroku[router]: at=info method=POST path=/problems host=some_RoR_app.herokuapp.com fwd="111.222.333.444" dyno=web.1 connect=2ms service=41ms status=500 bytes=643
Result
Same errors as Way #4
This has been driving me crazy.
Do you know what I am doing wrong? How can I fix this? I'll be happy to answer any questions that could help you help me. Just leave a comment.
try adding :
client.setRequestHeader('enctype', 'multipart/form-data');
before the open function.
I have just deployed my app on Heroku. I have access to home however when I create an account I have the error "we're sorry but something were wrong". In the heroku console there are the following lines :
2013-07-25T14:43:57.205734+00:00 app[web.1]:
2013-07-25T14:43:57.326077+00:00 app[web.1]:
2013-07-25T14:43:57.326077+00:00 app[web.1]: app/controllers/users_controller.rb:36:in `create'
2013-07-25T14:43:57.326077+00:00 app[web.1]: Errno::ECONNREFUSED (Connection refused - {:data=>"<?xml version=\"1.0\" encoding=\"UTF-8\"?><add><doc><field name=\"id\">User 23</field><field name=\"type\">User</field><field name=\"type\">ActiveRecord::Base</field><field name=\"class_name\">User</field><field name=\"nom_text\">julien</field><field name=\"email_text\">julien#resenders.com</field></doc></add>", :headers=>{"Content-Type"=>"text/xml"}, :method=>:post, :params=>{:wt=>:ruby}, :query=>"wt=ruby", :path=>"update", :uri=>#<URI::HTTP:0x007f987b4c48a0 URL:http://localhost:8080/solr/update?wt=ruby>, :open_timeout=>nil, :read_timeout=>nil, :retry_503=>nil, :retry_after_limit=>nil}):
2013-07-25T14:43:57.337273+00:00 app[web.1]: Processing by UsersController#create as HTML
2013-07-25T14:43:57.326077+00:00 app[web.1]:
2013-07-25T14:43:57.326077+00:00 app[web.1]:
2013-07-25T14:43:57.337273+00:00 app[web.1]: Completed 500 Internal Server Error in 850ms
2013-07-25T14:43:57.337273+00:00 app[web.1]: Parameters: {"utf8"=>"???", "authenticity_token"=>"gdLt0F1TJi+GaFCe8sFFKRikXgAEEnW6DmIyPbLeCa4=", "user"=>{"nom"=>"julien", "email"=>"julien#resenders.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "resender"=>"0", "gang_id"=>"1", "addresses_attributes"=>{"0"=>{"first_name"=>"L", "last_name"=>"L"}}}, "commit"=>"Inscription"}
2013-07-25T14:43:57.337273+00:00 app[web.1]: Rendered devise/mailer/confirmation_instructions.html.erb (1.3ms)
2013-07-25T14:43:57.344954+00:00 heroku[router]: at=info method=POST path=/users host=www.resenders.com fwd="37.58.138.20" dyno=web.1 connect=4ms service=930ms status=500 bytes=643
I figured out the problem in local with "rake sunspot:solr:run" but even if "heroku run rake sunspot:solr:run" seems to work, it does not sort out this trouble on Heroku. How can I do ? Maybe with Websolr ? Thank you in advance guys !
4 Suggestions:
Be sure that your server is running
Be sure that your routes are set correctly
Add the websolr add on to your heroku stack --> https://devcenter.heroku.com/articles/websolr
Be sure to always remove personal data when pasting code to the internet
I've built an simple rails app and am deploying it to heroku. The app uses devise for authentication. Everything works fine in development and production environment, ACCEPT when one tries to log in via the Mobile Safari browser on iOS.
Heroku logs say the following:
2012-10-17T18:56:52+00:00 app[web.1]: Started POST "/users/sign_in" for 87.123.175.106 at 2012-10-17 20:56:52 +0200
2012-10-17T18:56:52+00:00 app[web.1]: Processing by Devise::SessionsController#create as HTML
2012-10-17T18:56:52+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"SHHVgAxRFJ8VFu2cnbh/YGn6s6q0L9Mnp24x9Whu2mk=", "user"=>{"name"=>"test", "password"=>"[FILTERED]"}, "commit"=>"anmelden"}
2012-10-17T18:56:52+00:00 app[web.1]: WARNING: Can't verify CSRF token authenticity
2012-10-17T18:56:53+00:00 app[web.1]: Redirected to http://xxxxxxxx.herokuapp.com/
The problem doesn't occur with other iOS browsers such as Opera.
I didn't do any custom stuff to devise (except for adding a user name), it is implemented pretty much out of the box.
I have read several posts where the issue with iOS and CSRF token is vaguely addressed, but I'm pretty new to rails and don't really know how to fix this. Can anyone help, please?
UPDATE:
As advised in this post, I commented out protect_from_forgery in application_controller.rb as well as the csrf_meta_tags in application.html.erb.
Also, I added :domain => :all to config/session_store.rb.
Nothing helped. Obiously, I don't get the Can't verify CSRF token authenticity error anymore, but the following logs:
2012-10-18T18:19:03+00:00 app[web.1]: Started POST "/users/sign_in" for 87.123.130.136 at 2012-10-18 20:19:03 +0200
2012-10-18T18:19:03+00:00 app[web.1]: Processing by Devise::SessionsController#create as HTML
2012-10-18T18:19:03+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"Q+fF+9Sj2Q+X2VV34Jkrt1K8C3u4/NB6YC3yslYjkyQ=", "user"=>{"name"=>"test", "password"=>"[FILTERED]"}, "commit"=>"anmelden"}
2012-10-18T18:19:03+00:00 heroku[router]: POST pacific-beyond-5428.herokuapp.com/users/sign_in dyno=w
eb.1 queue=0 wait=0ms service=783ms status=302 bytes=107
2012-10-18T18:19:03+00:00 app[web.1]: Redirected to http://pacific-beyond-5428.herokuapp.com/
2012-10-18T18:19:03+00:00 app[web.1]: Completed 302 Found in 577ms (ActiveRecord: 0.0ms)
2012-10-18T18:19:04+00:00 app[web.1]:
2012-10-18T18:19:04+00:00 app[web.1]:
2012-10-18T18:19:04+00:00 app[web.1]: Started GET "/" for 87.123.130.136 at 2012-10-18 20:19:04 +0200
2012-10-18T18:19:04+00:00 app[web.1]: Processing by HomeController#index as HTML
2012-10-18T18:19:04+00:00 app[web.1]: Completed 401 Unauthorized in 0ms
2012-10-18T18:19:04+00:00 heroku[router]: GET pacific-beyond-5428.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=12ms status=302 bytes=120
2012-10-18T18:19:04+00:00 app[web.1]:
2012-10-18T18:19:04+00:00 app[web.1]: Started GET "/users/sign_in" for 87.123.130.136 at 2012-10-18 20:19:04 +0200
2012-10-18T18:19:04+00:00 app[web.1]: Processing by Devise::SessionsController#new as HTML
2012-10-18T18:19:04+00:00 app[web.1]:
2012-10-18T18:19:04+00:00 app[web.1]: Rendered layouts/_navigation.html.erb (1.4ms)
2012-10-18T18:19:04+00:00 app[web.1]: Rendered devise/shared/_links.html.erb (0.7ms)
2012-10-18T18:19:04+00:00 app[web.1]: Rendered devise/sessions/new.html.erb within layouts/application (25.8ms)
2012-10-18T18:19:04+00:00 app[web.1]: Rendered layouts/_messages.html.erb (0.4ms)
2012-10-18T18:19:04+00:00 app[web.1]: Rendered layouts/_sidebar.html.erb (0.3ms)
2012-10-18T18:19:04+00:00 app[web.1]: Completed 200 OK in 33ms (Views: 31.9ms | ActiveRecord: 0.0ms)
2012-10-18T18:19:04+00:00 heroku[router]: GET pacific-beyond-5428.herokuapp.com/users/sign_in dyno=web.1 queue=0 wait=0ms service=44ms status=200 bytes=2361
2012-10-18T18:19:04+00:00 app[web.1]:
2012-10-18T18:19:04+00:00 app[web.1]:
2012-10-18T18:19:04+00:00 app[web.1]: Started GET "/assets/foundation/app.js" for 87.123.130.136 at 2012-10-18 20:19:04 +0200
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/app.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Served asset /foundation/app.js - 304 Not Modified (282ms)
2012-10-18T18:19:05+00:00 heroku[router]: GET pacific-beyond-5428.herokuapp.com/assets/foundation/app.js dyno=web.1 queue=0 wait=0ms service=297ms status=304 bytes=0
2012-10-18T18:19:05+00:00 app[web.1]:
2012-10-18T18:19:05+00:00 app[web.1]:
2012-10-18T18:19:05+00:00 app[web.1]: Started GET "/assets/foundation/index.js" for 87.123.130.136 at 2012-10-18 20:19:05 +0200
2012-10-18T18:19:05+00:00 heroku[router]: GET pacific-beyond-5428.herokuapp.com/assets/foundation/index.js dyno=web.1 queue=0 wait=0ms service=905ms status=304 bytes=0
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/modernizr.foundation.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.placeholder.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.alerts.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.accordion.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.buttons.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.tooltips.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.forms.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.tabs.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.navigation.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.topbar.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.reveal.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.orbit.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/jquery.foundation.mediaQueryToggle.js (0ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Compiled foundation/index.js (86ms) (pid 2)
2012-10-18T18:19:05+00:00 app[web.1]: Served asset /foundation/index.js - 304 Not Modified (616ms)
Somebody an Idea?
I had this same errorm seeing the same symptoms on production in the Heroku logs of:
WARNING: Can't verify CSRF token authenticity
And the 401 Unauthorized redirect after login attempt.
The resolution for me was to add domain: :all to the session_store in config/initializers/session_store.rb.