我有一个回调URL,在MessagesController中概述如下:
def message_create
message = Message.new( :message => params[:PAYLOAD],
:recipient => params[:DEST_ADDR],
:api_message_id => params[:MSG_ID],
:from => params[:SRC_ADDR],
:api_timestamp => params[:DATETIME],
:network => params[:NETWORK],
:origin => "sms")
message.save
redirect_to message
end
当我在本地运行我的应用程序时,此回调URL工作正常:
但是,当我将应用程序推送到heroku并输入相同的回调URL时:
它只是给了我一个错误。我已经研究过它是否是由于:
before_filter :authenticate
在我的控制器中排队,但即使被注释掉,数据也不会提交给远程数据库。非常感谢您的想法和经验。
更新:
刚刚研究了如何访问Heroku上的完整日志。看起来问题可能与默认情况下Heroku中的整数不够大有关:
2011-09-15T13:25:28+00:00 app[web.1]: Started GET "/message_create?PAYLOAD=asdfasdf&DEST_ADDR=234523&MSG_ID=23452345&SRC_ADDR=24345234234&DATETIME=20110915130534&NETWORK=blah" for 80.46.10.63 at 2011-09-15 06:25:28 -0700
2011-09-15T13:25:28+00:00 app[web.1]: Processing by MessagesController#message_create as HTML
2011-09-15T13:25:28+00:00 app[web.1]: Parameters: {"PAYLOAD"=>"asdfasdf", "DEST_ADDR"=>"234523", "MSG_ID"=>"23452345", "SRC_ADDR"=>"24345234234", "DATETIME"=>"20110915130534", "NETWORK"=>"blah"}
2011-09-15T13:25:28+00:00 app[web.1]: Completed in 10ms
2011-09-15T13:25:28+00:00 app[web.1]:
2011-09-15T13:25:28+00:00 app[web.1]: ActiveRecord::StatementInvalid (PGError: ERROR: integer out of range
2011-09-15T13:25:28+00:00 app[web.1]: : INSERT INTO "messages" ("message", "created_at", "updated_at", "recipient", "api_message_id", "from", "origin", "timestamps", "user_id", "status", "api_timestamp", "network", "group_id") VALUES ('asdfasdf', '2011-09-15 13:25:28.650894', '2011-09-15 13:25:28.650894', 234523, 23452345, 24345234234, 'sms', NULL, NULL, NULL, '2011-09-15 13:05:34.000000', 'blah', NULL) RETURNING "id"):
2011-09-15T13:25:28+00:00 app[web.1]: app/controllers/messages_controller.rb:48:in `message_create'
2011-09-15T13:25:28+00:00 app[web.1]:
2011-09-15T13:25:28+00:00 app[web.1]:
2011-09-15T13:25:28+00:00 heroku[router]: GET www.myherokuapp.com/message_create dyno=web.1 queue=0 wait=0ms service=14ms status=500 bytes=728
2011-09-15T13:25:28+00:00 heroku[nginx]: 80.46.10.63 - - [15/Sep/2011:06:25:28 -0700] "GET /message_create?PAYLOAD=asdfasdf&DEST_ADDR=234523&MSG_ID=23452345&SRC_ADDR=24345234234&DATETIME=20110915130534&NETWORK=blah HTTP/1.1" 500 728 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.12 Safari/535.2" www.myherokuapp.com
答案 0 :(得分:0)
是的,它似乎是一个数据类型错误,您为消息表迁移中的字段设置了哪些数据类型?