rake hoptoad:test works in development, but not in production
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.
Comments are currently closed for this discussion. You can start a new one.
2 Posted by c47 on 21 Feb, 2009 05:29 AM
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.
3 Posted by alex on 21 Feb, 2009 06:41 PM
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.
4 Posted by mark on 25 Feb, 2009 02:06 AM
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
5 Posted by tammersaleh on 25 Feb, 2009 02:19 PM
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.
tammersaleh resolved this discussion on 25 Feb, 2009 02:19 PM.
alex re-opened this discussion on 28 Feb, 2009 02:39 AM
6 Posted by alex on 28 Feb, 2009 02:39 AM
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
is semantically different from
(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.
7 Posted by tammersaleh on 04 Mar, 2009 08:20 PM
Alex,
If you export the RAILS_ENV to production before running the test task, does that then work correctly?
Support Staff 8 Posted by Joe Ferris on 19 May, 2009 08:53 PM
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
Support Staff 9 Posted by Joe Ferris on 01 Jul, 2009 09:36 PM
Hey Alex,
I'm marking this as resolved, but please let us know if you're still having trouble.
Thanks,
-Joe
Joe Ferris resolved this discussion on 01 Jul, 2009 09:36 PM.