2017-01-23 69 views
0

在升級到messenger-ruby gem的版本1.2.0後,我使用它來獲取Facebook Messenger用戶在快速回復中的位置,似乎messenger-ruby無法解析返回的位置附件對象。在我有機會發回200 OK響應之前發生此錯誤,因此控制器被掛起。我該如何解決這個問題?messenger-ruby ArgumentError(missing keyword:payload)

這裏是Heroku的日誌文件的片段:

2017-01-23T03:15:52.544541+00:00 app[web.1]: Started POST "/messenger/webhook" for 173.252.123.140 at 2017-01-23 03:15:52 +0000 
2017-01-23T03:15:52.547400+00:00 app[web.1]: Processing by MessengerController#webhook as */* 
2017-01-23T03:15:52.547618+00:00 app[web.1]: Parameters: {"object"=>"page", "entry"=>[{"id"=>"776445229159135", "time"=>1485141352448, "messaging"=>[{"sender"=>{"id"=>"938332056296353"}, "recipient"=>{"id"=>"776445229159135"}, "timestamp"=>1485120971441, "message"=>{"mid"=>"mid.1485120971441:34f1a70557", "seq"=>3197, "attachments"=>[{"title"=>"James's Location", "url"=>"url redacted", "type"=>"location", "payload"=>{"coordinates"=>{"lat"=>36.074067028043, "long"=>-95.645990201969}}}]}}]}], "messenger"=>{"object"=>"page", "entry"=>[{"id"=>"776445229159135", "time"=>1485141352448, "messaging"=>[{"sender"=>{"id"=>"938332056296353"}, "recipient"=>{"id"=>"776445229159135"}, "timestamp"=>1485120971441, "message"=>{"mid"=>"mid.1485120971441:34f1a70557", "seq"=>3197, "attachments"=>[{"title"=>"James's Location", "url"=>"url redacted, "type"=>"location", "payload"=>{"coordinates"=>{"lat"=>36.074067028043, "long"=>-95.645990201969}}}]}}]}]}} 
2017-01-23T03:15:52.549321+00:00 app[web.1]: Completed 500 Internal Server Error in 2ms (ActiveRecord: 0.0ms) 
2017-01-23T03:15:52.549885+00:00 app[web.1]: 
2017-01-23T03:15:52.549888+00:00 app[web.1]: app/controllers/messenger_controller.rb:8:in `webhook' 
2017-01-23T03:15:52.549887+00:00 app[web.1]: ArgumentError (missing keyword: payload) 

回答

0

更新:我不知道發生了什麼,但我做了一些更多的調試,這開始工作。我複製了Facebook發給我的對象,並在克隆github中的gem之後打開了一個控制檯,完全沒有問題!