2012-04-06 10 views
0

Ich entwickle eine Rails-App, die in der Entwicklung gut funktioniert. Wenn ich jedoch auf Heroku umstelle, stoße ich auf Probleme. Die App funktioniert gut, bis ich einen neuen Benutzer erstellen kann. In diesem Fall bekomme ich "Es tut uns leid, aber etwas ist schiefgelaufen." Ich habe versucht, die Datenbank über pg:reset zu entladen und die Datenbank zu migrieren. Hier ist meine Protokolle heroku logs:Heroku "Es tut uns leid, aber etwas ging schief."

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 

Wer irgendwelche Ideen, was dieses verursachen würde? Sehr verwirrend, dass es in meiner Entwicklungsumgebung funktioniert, aber nicht in Produktion auf Heroku.

WowCharacter Modell:

# == 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 

Nicht sicher, ob das hilft, aber nach etwas mehr Tests machen kann ich bestätigen, dass es aufhört auf: app[web.1]: cache: [POST /users] invalidate, pass jedes Mal. Ich habe das herausgefunden, indem ich die Heroku-Logs verfolgt habe.

+0

ich meinen Beitrag aktualisiert, um das WowCharacter Modell aufgenommen werden und die Datenbank wird in den Kommentaren an der Spitze des Modells kommentiert. – Valjas

+0

Ich meine nicht die ganze Datenbank, sondern die wow_characters-Tabelle. Offensichtlich, aber gemustert sollte es der Klarheit halber noch erwähnen. – Valjas

+0

Sie verwenden eine Postgresql-Datenbank in Ihrer Entwicklungsumgebung? – shingara

Antwort

1

Ich konnte dieses Problem beheben. Ich entschied mich, SQLite3 durch Postgre in meiner Entwicklung ENV zu ersetzen, so dass es meinem Setup in Heroku entsprach. Nachdem ich das getan hatte, war ich in der Lage, das Problem viel einfacher zu debuggen und was es letztendlich war, war ein Typcasting-Problem. Das :last_modified Feld ist :datetime aber der Wert ich in sie schob war ein UNIX-Zeitstempel und wurde ein Fehler mit Postgre werfen:

„Typ-Zeitstempel ohne Zeitzone aber Ausdruck vom Typ bigint“

ich war in der Lage, das Problem zu beheben, indem eine Konvertierung auf dem UNIX Zeitpunkt ausgeführt wird:

:last_modified = Time.at(timestamp) 
Verwandte Themen