Heroku“我们很抱歉,但出了点问题。”

时间:2012-04-06 06:21:39

标签: ruby-on-rails heroku

我正在开发一个在开发中运行良好的Rails应用程序。但是,当我部署到Heroku时,我遇到了问题。该应用程序工作正常,直到我去创建一个新用户,在这种情况下,我得到“我们很抱歉,但出了点问题。”我试过通过pg:reset转储数据库并迁移数据库。这是我的日志heroku logs

2012-04-06T06:09:14+00:00 app[web.1]:       - 45550
2012-04-06T06:09:14+00:00 app[web.1]:       - 45553
2012-04-06T06:09:14+00:00 app[web.1]:       - 45554
2012-04-06T06:09:14+00:00 app[web.1]:       - 45557
2012-04-06T06:09:14+00:00 app[web.1]:       - 45560
2012-04-06T06:09:14+00:00 app[web.1]:       - 45561
2012-04-06T06:09:14+00:00 app[web.1]:       - 45563
2012-04-06T06:09:14+00:00 app[web.1]:       - 45564
2012-04-06T06:09:14+00:00 app[web.1]:       - 45562
2012-04-06T06:09:14+00:00 app[web.1]:       - 45565
2012-04-06T06:09:14+00:00 app[web.1]:       - 45566
2012-04-06T06:09:14+00:00 app[web.1]:       - 45569
2012-04-06T06:09:14+00:00 app[web.1]:       - 53056
2012-04-06T06:09:14+00:00 app[web.1]:       - 57421
2012-04-06T06:09:14+00:00 app[web.1]:       - 58512
2012-04-06T06:09:14+00:00 app[web.1]:       - 58065
2012-04-06T06:09:14+00:00 app[web.1]:       - 58521
2012-04-06T06:09:14+00:00 app[web.1]:       - 58523
2012-04-06T06:09:14+00:00 app[web.1]:       - 58525
2012-04-06T06:09:14+00:00 app[web.1]:       - 58528
2012-04-06T06:09:14+00:00 app[web.1]:       - 62044
2012-04-06T06:09:14+00:00 app[web.1]:       - 62045
2012-04-06T06:09:14+00:00 app[web.1]:       - 62049
2012-04-06T06:09:14+00:00 app[web.1]:       - 62050
2012-04-06T06:09:14+00:00 app[web.1]:       - 64054
2012-04-06T06:09:14+00:00 app[web.1]:       - 64358
2012-04-06T06:09:14+00:00 app[web.1]:       - 62051
2012-04-06T06:09:14+00:00 app[web.1]:       - 93741
2012-04-06T06:09:14+00:00 app[web.1]: ', "achievement_points" = 5090, "thumbnail" = 'kiljaeden/52/114968116-avatar.jpg', "last_modified" = 1332004740000, "stats" = '--- !ruby/object:OpenStruct 
2012-04-06T06:09:14+00:00 app[web.1]: modifiable: true
2012-04-06T06:09:14+00:00 app[web.1]: table: 
2012-04-06T06:09:14+00:00 app[web.1]:   :health: 133243
2012-04-06T06:09:14+00:00 app[web.1]:   :powerType: mana
2012-04-06T06:09:14+00:00 app[web.1]:   :power: 107618
2012-04-06T06:09:14+00:00 app[web.1]:   :agi: 58
2012-04-06T06:09:14+00:00 app[web.1]:   :sta: 6885
2012-04-06T06:09:14+00:00 app[web.1]:   :int: 6032
2012-04-06T06:09:14+00:00 app[web.1]:   :str: 53
2012-04-06T06:09:14+00:00 app[web.1]:   :spr: 411
2012-04-06T06:09:14+00:00 app[web.1]:   :attackPower: 43
2012-04-06T06:09:14+00:00 app[web.1]:   :rangedAttackPower: 0
2012-04-06T06:09:14+00:00 app[web.1]:   :mastery: 11.369031
2012-04-06T06:09:14+00:00 app[web.1]:   :masteryRating: 604
2012-04-06T06:09:14+00:00 app[web.1]:   :crit: 10.45436
2012-04-06T06:09:14+00:00 app[web.1]:   :critRating: 1203
2012-04-06T06:09:14+00:00 app[web.1]:   :hitRating: 1653
2012-04-06T06:09:14+00:00 app[web.1]:   :hasteRating: 2612
2012-04-06T06:09:14+00:00 app[web.1]:   :hitPercent: 14.762522
2012-04-06T06:09:14+00:00 app[web.1]:   :expertiseRating: 0
2012-04-06T06:09:14+00:00 app[web.1]:   :spellPower: 8355
2012-04-06T06:09:14+00:00 app[web.1]:   :spellPen: 0
2012-04-06T06:09:14+00:00 app[web.1]:   :spellCrit: 19.913286
2012-04-06T06:09:14+00:00 app[web.1]:   :spellCritRating: 1203
2012-04-06T06:09:14+00:00 app[web.1]:   :mana5: 1404.0
2012-04-06T06:09:14+00:00 app[web.1]:   :spellHitPercent: 17.13537
2012-04-06T06:09:14+00:00 app[web.1]:   :spellHitRating: 1653
2012-04-06T06:09:14+00:00 app[web.1]:   :mana5Combat: 869.0
2012-04-06T06:09:14+00:00 app[web.1]:   :armor: 9195
2012-04-06T06:09:14+00:00 app[web.1]:   :dodge: 3.652076
2012-04-06T06:09:14+00:00 app[web.1]:   :dodgeRating: 0
2012-04-06T06:09:14+00:00 app[web.1]:   :parry: 0.0
2012-04-06T06:09:14+00:00 app[web.1]:   :parryRating: 0
2012-04-06T06:09:14+00:00 app[web.1]:   :block: 0.0
2012-04-06T06:09:14+00:00 app[web.1]:   :mainHandDmgMin: 313.0
2012-04-06T06:09:14+00:00 app[web.1]:   :blockRating: 0
2012-04-06T06:09:14+00:00 app[web.1]:   :resil: 0
2012-04-06T06:09:14+00:00 app[web.1]:   :mainHandDmgMax: 579.0
2012-04-06T06:09:14+00:00 app[web.1]:   :mainHandSpeed: 1.329
2012-04-06T06:09:14+00:00 app[web.1]:   :mainHandDps: 335.91428
2012-04-06T06:09:14+00:00 app[web.1]:   :mainHandExpertise: 0
2012-04-06T06:09:14+00:00 app[web.1]:   :offHandDmgMin: 0.0
2012-04-06T06:09:14+00:00 app[web.1]:   :offHandDmgMax: 0.0
2012-04-06T06:09:14+00:00 app[web.1]:   :offHandDps: 0.0
2012-04-06T06:09:14+00:00 app[web.1]:   :offHandSpeed: 1.661
2012-04-06T06:09:14+00:00 app[web.1]:   :offHandExpertise: 0
2012-04-06T06:09:14+00:00 app[web.1]:   :rangedDmgMin: 1581.0
2012-04-06T06:09:14+00:00 app[web.1]:   :rangedDmgMax: 2937.0
2012-04-06T06:09:14+00:00 app[web.1]:   :rangedDps: 1511.1627
2012-04-06T06:09:14+00:00 app[web.1]:   :rangedSpeed: 1.495
2012-04-06T06:09:14+00:00 app[web.1]:   :rangedCrit: 10.45436
2012-04-06T06:09:14+00:00 app[web.1]:   :rangedCritRating: 1203
2012-04-06T06:09:14+00:00 app[web.1]:   :rangedHitRating: 1653
2012-04-06T06:09:14+00:00 app[web.1]:   :rangedHitPercent: 14.762522
2012-04-06T06:09:14+00:00 app[web.1]: ', "appearance" = '--- !ruby/object:OpenStruct 
2012-04-06T06:09:14+00:00 app[web.1]: modifiable: true
2012-04-06T06:09:14+00:00 app[web.1]: table: 
2012-04-06T06:09:14+00:00 app[web.1]:   :faceVariation: 1
2012-04-06T06:09:14+00:00 app[web.1]:   :skinColor: 6
2012-04-06T06:09:14+00:00 app[web.1]:   :hairVariation: 13
2012-04-06T06:09:14+00:00 app[web.1]:   :hairColor: 0
2012-04-06T06:09:14+00:00 app[web.1]:   :showHelm: 0
2012-04-06T06:09:14+00:00 app[web.1]:   :featureVariation: 1
2012-04-06T06:09:14+00:00 app[web.1]:   :showCloak: 0
2012-04-06T06:09:14+00:00 app[web.1]: ', "updated_at" = '2012-04-06 06:09:14.199366', "progression" = '--- 
2012-04-06T06:09:14+00:00 app[web.1]: ' WHERE "wow_characters"."id" = 1):
2012-04-06T06:09:14+00:00 app[web.1]:   app/models/user.rb:66:in `fetch_character_info'
2012-04-06T06:09:14+00:00 app[web.1]:   app/controllers/users_controller.rb:25:in `create'
2012-04-06T06:09:14+00:00 app[web.1]: 
2012-04-06T06:09:14+00:00 app[web.1]: 
2012-04-06T06:09:14+00:00 app[web.1]: cache: [POST /users] invalidate, pass

任何人都有任何想法会导致什么?非常混乱,它在我的开发环境中工作,但在Heroku上没有生产。

WowCharacter模型:

# == Schema Information
#
# Table name: wow_characters
#
#  id                 :integer         not null, primary key
#  user_id            :integer
#  realm              :string(255)
#  name               :string(255)
#  level              :integer
#  race               :string(255)
#  class_id           :string(255)
#  gender             :integer
#  guild              :text
#  talents            :text
#  items              :text
#  professions        :text
#  progression        :text
#  achievement_points :integer
#  thumbnail          :string(255)
#  last_modified      :datetime
#  created_at         :datetime        not null
#  updated_at         :datetime        not null
#  stats              :text
#  appearance         :text
#

class WowCharacter < ActiveRecord::Base

  # Set accessible fields
  attr_accessible :user_id, :realm, :name, :level, :race, :class_id, :gender, :guild, :stats,
                  :talents, :items, :professions, :appearance, :achievement_points, :thumbnail, 
                  :last_modified, :wow_character

  serialize :guild
  serialize :talents
  serialize :items 
  serialize :professions
  serialize :progression
  serialize :stats
  serialize :appearance

  # Create reference to User model
  belongs_to :user
end

不确定这是否有帮助,但在做了一些更多的测试后,我可以确认它会停止: 每次都app[web.1]: cache: [POST /users] invalidate, pass。我通过追踪heroku日志来解决这个问题。

1 个答案:

答案 0 :(得分:1)

我设法解决了这个问题。我决定在我的开发环境中用Postgre替换SQLite3,以便它符合我在Heroku中的设置。在这样做之后,我能够更容易地调试问题,最终结果是类型转换问题。 :last_modified字段为:datetime,但我推入的字段是UNIX时间戳,并且在Postgre中抛出错误:

  

“输入没有时区的时间戳,但表达式的类型为bigint”

我能够通过在UNIX时间戳上运行转换来解决此问题:

:last_modified = Time.at(timestamp)
相关问题