I am building an messenger bot on rails and firstly i want to say hello. For do that
1- I am following these instruction(http://ift.tt/26Guj10)
2- Then i am using heroku for putting my app on the web. So get error when i do this.
This is my bot.rb file under app/bot/bot.rb
require 'facebook/messenger'
include Facebook::Messenger
Bot.on :message do |message|
message.id # => 'mid.1457764197618:41d102a3e1ae206a38'
message.sender # => { 'id' => '1008372609250235' }
message.seq # => 73
message.sent_at # => 2016-04-22 21:30:36 +0200
message.text # => 'Hello, bot!'
message.attachments # => [ { 'type' => 'image', 'payload' => { 'url' => 'http://ift.tt/2efcRdZ' } } ]
Bot.deliver(
recipient: message.sender,
message: {
text: 'Hello, human!'
}
)
Bot.on :postback do |postback|
postback.sender # => { 'id' => '1008372609250235' }
postback.recipient # => { 'id' => '2015573629214912' }
postback.sent_at # => 2016-04-22 21:30:36 +0200
postback.payload # => 'EXTERMINATE'
if postback.payload == 'EXTERMINATE'
puts "Human #{postback.recipient} marked for extermination"
end
end
Bot.on :optin do |optin|
optin.sender # => { 'id' => '1008372609250235' }
optin.recipient # => { 'id' => '2015573629214912' }
optin.sent_at # => 2016-04-22 21:30:36 +0200
optin.ref # => 'CONTACT_SKYNET'
Bot.deliver(
recipient: optin.sender,
message: {
text: 'Ah, human!'
}
)
end
Bot.on :delivery do |delivery|
delivery.ids # => 'mid.1457764197618:41d102a3e1ae206a38'
delivery.sender # => { 'id' => '1008372609250235' }
delivery.recipient # => { 'id' => '2015573629214912' }
delivery.at # => 2016-04-22 21:30:36 +0200
delivery.seq # => 37
puts "Human was online at #{delivery.at}"
end
I am getting these error at my heroku app
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
This is my result of heroku logs
2016-10-17T17:37:55.770669+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
2016-10-17T17:37:55.770726+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
2016-10-17T17:37:55.770696+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `instance_exec'
2016-10-17T17:37:55.770711+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `run'
2016-10-17T17:37:55.770741+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
2016-10-17T17:37:55.770756+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
2016-10-17T17:37:55.770786+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
2016-10-17T17:37:55.770771+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
2016-10-17T17:37:55.770843+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
2016-10-17T17:37:55.770815+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `call'
2016-10-17T17:37:55.770801+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each'
2016-10-17T17:37:55.770868+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
2016-10-17T17:37:55.770884+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
2016-10-17T17:37:55.770898+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:54:in `run_initializers'
2016-10-17T17:37:55.770913+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:352:in `initialize!'
2016-10-17T17:37:55.770929+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>'
2016-10-17T17:37:55.770944+00:00 app[web.1]: from config.ru:3:in `require_relative'
2016-10-17T17:37:55.770959+00:00 app[web.1]: from config.ru:3:in `block in <main>'
2016-10-17T17:37:55.770974+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
2016-10-17T17:37:55.770989+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
2016-10-17T17:37:55.771019+00:00 app[web.1]: from config.ru:in `new'
2016-10-17T17:37:55.771047+00:00 app[web.1]: from config.ru:in `<main>'
2016-10-17T17:37:55.771077+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
2016-10-17T17:37:55.771062+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
2016-10-17T17:37:55.771093+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
2016-10-17T17:37:55.771107+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/lib/puma/configuration.rb:315:in `load_rackup'
2016-10-17T17:37:55.771122+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/lib/puma/configuration.rb:243:in `app'
2016-10-17T17:37:55.771137+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/lib/puma/runner.rb:127:in `load_and_bind'
2016-10-17T17:37:55.771152+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/lib/puma/single.rb:85:in `run'
2016-10-17T17:37:55.771167+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/lib/puma/launcher.rb:172:in `run'
2016-10-17T17:37:55.771195+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/lib/puma/cli.rb:74:in `run'
2016-10-17T17:37:55.771222+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/bin/puma:10:in `<top (required)>'
2016-10-17T17:37:55.771238+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/bin/puma:23:in `load'
2016-10-17T17:37:55.771253+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/bin/puma:23:in `<main>'
2016-10-17T17:37:55.899711+00:00 heroku[web.1]: Process exited with status 1
2016-10-17T17:37:55.892951+00:00 heroku[web.1]: State changed from starting to crashed
2016-10-17T17:43:28.389559+00:00 heroku[web.1]: State changed from crashed to starting
2016-10-17T17:43:31.094495+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
2016-10-17T17:43:33.892184+00:00 app[web.1]: Puma starting in single mode...
2016-10-17T17:43:33.892202+00:00 app[web.1]: * Version 3.6.0 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity
2016-10-17T17:43:33.892203+00:00 app[web.1]: * Min threads: 5, max threads: 5
2016-10-17T17:43:33.892205+00:00 app[web.1]: * Environment: production
2016-10-17T17:43:35.493955+00:00 app[web.1]: ! Unable to load application: SyntaxError: /app/app/bot/bot.rb:53: syntax error, unexpected end-of-input, expecting keyword_end
2016-10-17T17:43:35.493990+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:263:in `rescue in load_dependency': /app/app/bot/bot.rb:53: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)
2016-10-17T17:43:35.494011+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:256:in `load_dependency'
2016-10-17T17:43:35.494012+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
2016-10-17T17:43:35.494012+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:380:in `block in require_or_load'
2016-10-17T17:43:35.494013+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:37:in `block in load_interlock'
2016-10-17T17:43:35.494015+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
2016-10-17T17:43:35.494016+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/concurrency/share_lock.rb:117:in `exclusive'
2016-10-17T17:43:35.494017+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies/interlock.rb:11:in `loading'
2016-10-17T17:43:35.494018+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:37:in `load_interlock'
2016-10-17T17:43:35.494019+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:358:in `require_or_load'
2016-10-17T17:43:35.494033+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:336:in `depend_on'
2016-10-17T17:43:35.494034+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:252:in `require_dependency'
2016-10-17T17:43:35.494035+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
2016-10-17T17:43:35.494037+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:475:in `each'
2016-10-17T17:43:35.494039+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:475:in `block in eager_load!'
2016-10-17T17:43:35.494041+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:473:in `each'
2016-10-17T17:43:35.494041+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:473:in `eager_load!'
2016-10-17T17:43:35.494042+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:354:in `eager_load!'
2016-10-17T17:43:35.494055+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:59:in `each'
2016-10-17T17:43:35.494056+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
2016-10-17T17:43:35.494058+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `instance_exec'
2016-10-17T17:43:35.494058+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `run'
2016-10-17T17:43:35.494059+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
2016-10-17T17:43:35.494073+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
2016-10-17T17:43:35.494073+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
2016-10-17T17:43:35.494075+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
2016-10-17T17:43:35.494075+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
2016-10-17T17:43:35.494077+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each'
2016-10-17T17:43:35.494078+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `call'
2016-10-17T17:43:35.494079+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
2016-10-17T17:43:35.494092+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
2016-10-17T17:43:35.494092+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
2016-10-17T17:43:35.494093+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:54:in `run_initializers'
2016-10-17T17:43:35.494095+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-5.0.0.1/lib/rails/application.rb:352:in `initialize!'
2016-10-17T17:43:35.494097+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>'
2016-10-17T17:43:35.494098+00:00 app[web.1]: from config.ru:3:in `require_relative'
2016-10-17T17:43:35.494099+00:00 app[web.1]: from config.ru:3:in `block in <main>'
2016-10-17T17:43:35.494112+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
2016-10-17T17:43:35.494112+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
2016-10-17T17:43:35.494113+00:00 app[web.1]: from config.ru:in `new'
2016-10-17T17:43:35.494115+00:00 app[web.1]: from config.ru:in `<main>'
2016-10-17T17:43:35.494116+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
2016-10-17T17:43:35.494130+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
2016-10-17T17:43:35.494159+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
2016-10-17T17:43:35.494160+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/lib/puma/configuration.rb:315:in `load_rackup'
2016-10-17T17:43:35.494160+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/lib/puma/configuration.rb:243:in `app'
2016-10-17T17:43:35.494161+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/lib/puma/runner.rb:127:in `load_and_bind'
2016-10-17T17:43:35.494163+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/lib/puma/single.rb:85:in `run'
2016-10-17T17:43:35.494164+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/lib/puma/launcher.rb:172:in `run'
2016-10-17T17:43:35.494165+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/lib/puma/cli.rb:74:in `run'
2016-10-17T17:43:35.494166+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/puma-3.6.0/bin/puma:10:in `<top (required)>'
2016-10-17T17:43:35.494168+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/bin/puma:23:in `load'
2016-10-17T17:43:35.494168+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/bin/puma:23:in `<main>'
2016-10-17T17:43:35.626538+00:00 heroku[web.1]: State changed from starting to crashed
2016-10-17T17:43:35.613367+00:00 heroku[web.1]: Process exited with status 1
2016-10-17T17:51:06.046403+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=glacial-woodland-33867.herokuapp.com request_id=40aae514-ece3-4d20-80ec-ed54aea9000e fwd="95.70.128.173" dyno= connect= service= status=503 bytes=
2016-10-17T17:51:06.752064+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-woodland-33867.herokuapp.com request_id=9d9eb0c1-c46b-42c8-8775-4e8349afea2e fwd="95.70.128.173" dyno= connect= service= status=503 bytes=
2016-10-17T17:51:30.850595+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=glacial-woodland-33867.herokuapp.com request_id=7e8fcd04-4aec-477e-a166-2fa02c554f2c fwd="95.70.128.173" dyno= connect= service= status=503 bytes=
Aucun commentaire:
Enregistrer un commentaire