rake hoptoad:test works in development, but not in production

alex's Avatar

alex

21 Feb, 2009 02:06 AM via web

I just installed Hoptoad and followed the README. I ran "rake hoptoad:test" from my development box and it worked as expected (a notification showed up on the website).

I then did "cap deploy" and ssh'd to my server and ran "rake hoptoad:test" again. No love this time. Instead it took 20 seconds to exit, and when it was done, there was no new error on the website. (On the server I had to specify RAILS_ENV=production on the rake command line since there is no development database on the server.)

I also tried the console and got the following (again, with a 10+ second delay).

$ script/console production
Loading production environment (Rails 2.2.2)
>> HoptoadNotifier.notify(:error_class => "Testing Hoptoad")
=> "Hoptoad Failure: NilClass\n"

What could be the problem? I can ping hoptoadapp.com from my server just fine.

  1. 2 Posted by c47 on 21 Feb, 2009 05:29 AM

    c47's Avatar

    I'm having the same issue .... Running rake hoptoad:test on my production server gives me this error


    rake aborted!

    development database is not configured

    please advise.

  2. 3 Posted by alex on 21 Feb, 2009 06:41 PM

    alex's Avatar

    Well, I just got a real error from production, so I guess that means that it's working. But "rake hoptoad:test" should really be made to work properly from a non-development environment, so we can assure ourselves it's all connected properly from the live server.

  3. 4 Posted by mark on 25 Feb, 2009 02:06 AM

    mark's Avatar

    It should work if you make sure to set the RAILS_ENV environment variable to 'production' prior to running the rake task. Like this:

    RAILS_ENV=production rake hoptoad:test

  4. 5 Posted by tammersaleh on 25 Feb, 2009 02:19 PM

    tammersaleh's Avatar

    Alex: Glad this is working for you now.

    All: The Hoptoad test task runs through your actual rails application, so if the application won't run under whatever RAILS_ENV you have setup, it won't work. We feel this is correct behavior for an end to end test like this. You want to be sure that the exceptions will go out when your app is running in production - not just development mode.

    Also (and this isn't well documented in the rails community) it's generally considered best practice to force all shells on your production server to set RAILS_ENV to production. That way you no longer need to change your RAILS_ENV after logging in. Basically, just add "RAILS_ENV=production" to your .bashrc file, and you should be good to go.

  5. tammersaleh resolved this discussion on 25 Feb, 2009 02:19 PM.

  6. alex re-opened this discussion on 28 Feb, 2009 02:39 AM

  7. 6 Posted by alex on 28 Feb, 2009 02:39 AM

    alex's Avatar

    Sorry to reopen this but I wanted to clarify a couple of things:

    One:

    Rake is annoying because there are two sources for ALL_CAPS variables: the environment and the command line. It's good to allow either or both. Note that

    RAILS_ENV=production rake foo
    

    is semantically different from

    rake foo RAILS_ENV=production
    

    (though I'm still a little fuzzy on the implications of this, inside a rake script).

    Two:

    My server can access hoptoad's OK, but even with the environment variable set (on the front of the command line), the rake task "hoptoad:test" still silently fails.

  8. 7 Posted by tammersaleh on 04 Mar, 2009 08:20 PM

    tammersaleh's Avatar

    Alex,

    My server can access hoptoad's OK, but even with the environment variable set (on the front of the command line), the rake task "hoptoad:test" still silently fails.

    If you export the RAILS_ENV to production before running the test task, does that then work correctly?

  9. Support Staff 8 Posted by Joe Ferris on 19 May, 2009 08:53 PM

    Joe Ferris's Avatar

    Hey Alex,

    Have you gotten the rake task to work in production yet? You may want to try with the latest version of the notifier, as it contains additional debugging info.

    Thanks,

    -Joe

  10. Support Staff 9 Posted by Joe Ferris on 01 Jul, 2009 09:36 PM

    Joe Ferris's Avatar

    Hey Alex,

    I'm marking this as resolved, but please let us know if you're still having trouble.

    Thanks,

    -Joe

  11. Joe Ferris resolved this discussion on 01 Jul, 2009 09:36 PM.

Comments are currently closed for this discussion. You can start a new one.