1

I am getting the error below following the tutorial in the book Learn Ruby on Rails.

I am able to launch my app manually by typing the URL into my browser but am wondering why Heroku open does not work.

Any idea what is happening here?

Heroku open error...

$ heroku open                                                                                                             
Opening peaks-app... failed                                                                                                                                                         
 !    Heroku client internal error.                                                                                                                                                 
 !    Search for help at: https://help.heroku.com                                                                                                                                   
 !    Or report a bug at: https://github.com/heroku/heroku/issues/new                                                                                                               

    Error:       Unable to find a browser command. If this is unexpected, Please rerun with environment variable LAUNCHY_DEBUG=true or the '-d' commandline option and file a bug at
 https://github.com/copiousfreetime/launchy/issues/new (Launchy::CommandNotFoundError)                                                                                              
    Backtrace:   /home/action/.heroku/client/vendor/gems/launchy-2.4.2/lib/launchy/applications/browser.rb:63:in `browser_cmdline'                                                  
                 /home/action/.heroku/client/vendor/gems/launchy-2.4.2/lib/launchy/applications/browser.rb:67:in `cmd_and_args'                                                     
                 /home/action/.heroku/client/vendor/gems/launchy-2.4.2/lib/launchy/applications/browser.rb:78:in `open'                                                             
                 /home/action/.heroku/client/vendor/gems/launchy-2.4.2/lib/launchy.rb:29:in `open'                                                                                  
                 /home/action/.heroku/client/lib/heroku/helpers.rb:328:in `block in launchy'                                                                                        
                 /home/action/.heroku/client/lib/heroku/helpers.rb:227:in `action'                                                                                                  
                 /home/action/.heroku/client/lib/heroku/helpers.rb:326:in `launchy'                                                                                                 
                 /home/action/.heroku/client/lib/heroku/command/apps.rb:342:in `open'                                                                                               
                 /home/action/.heroku/client/lib/heroku/command.rb:217:in `run'                                                                                                     
                 /home/action/.heroku/client/lib/heroku/cli.rb:33:in `start'                                                                                                        
                 /home/action/.parts/bin/heroku:24:in `<main>'                                                                                                                      

    Command:     heroku open                                                                                                                                                        
    Version:     heroku-toolbelt/3.12.1 (x86_64-linux) ruby/2.1.1 
brntsllvn
  • 931
  • 11
  • 18
  • 1
    Welcome to Stack Overflow. When you get errors, troubleshoot by reviewing the log files: `$ heroku logs`. Edit your question to add what you see when you view the log file. – Daniel Kehoe Oct 02 '14 at 05:02
  • I believe you are reporting two problems. "Unable to find a browser command" is an issue with the Heroku toolbelt not finding a browser to open. Since you've manually entered the URL to view your app on Heroku, that's not the problem. I've edited the title of the question. – Daniel Kehoe Oct 02 '14 at 05:07
  • Make sure you have set the Heroku environment variables to match configuration values from the *config/secrets.yml file*. The most likely problem is the app is unable to connect to Gmail due to issues with your credentials. – Daniel Kehoe Oct 02 '14 at 05:12
  • Thanks for your comments. Issue 1: *Heroku Open* still produces the same error _Opening brnt-myapp... failed_. Issue 2: I have _config/secrets.yml_ in front of me next to the shell displaying _Heroku Config_. The secret_key_base is different, I am not sure this matters. Also, I am using the gmail application-specific password (rather than my normal password), again not sure if this matters. Note that both the contact form (connecting to gmail) *and* the mailing list (connecting to Mailchimp) functionalities (terminology?) are not working while deploying using Heroku, but do work using Nitrous. – brntsllvn Oct 03 '14 at 17:49
  • It doesn't matter that the secret_key_base is different. You've got an issue with the credentials. Try with the same credentials that work on Nitrous. – Daniel Kehoe Oct 03 '14 at 23:51
  • My credentials are stored as environment variables in the .bashrc file, so they are the same in Nitrous and Heroku. I just copy/pasted your environments/development.rb file to confirm no problems with that file and am still having the same issues using both Mailchimp and Gmail in Heroku. – brntsllvn Oct 05 '14 at 16:07
  • I am going to rebuild the app from scratch to both attempt to fix this error and to dig deeper into ruby and how the mvc framework works. I will reopen this issue if it persists after the rebuild. Thanks for taking a look. – brntsllvn Oct 05 '14 at 18:46
  • Your problem is with the Heroku configuration (the app runs fine locally, you say). Rebuilding the app won't fix the Heroku problem. The environment variables in the .bashrc file are not available to Heroku. See the book "Set Heroku Environment Variables" section. You need to explicitly set environment variables with `heroku config:add`. – Daniel Kehoe Oct 05 '14 at 20:46
  • Heroku configuration did the trick. I was using the title of my list (something like "my_first_list") rather than the proper list id located in Mailchimp -> Lists -> Settings -> List name & defaults. Should have known better given my list id is stored as an Environment Variable in my .bashrc file. Seems redundant (and obviously error-prone) to have to enter these data twice (1. as an Environment Var and 2) to config Heroku)...is there any way to simply have Heroku rip my Environment Variables from my Rails app? – brntsllvn Oct 08 '14 at 01:21
  • You can use the Figaro gem which has a command to transfer the Env variables to Heroku. Not really worth the trouble, though. – Daniel Kehoe Oct 08 '14 at 04:56

1 Answers1

2

The short answer is that Heroku uses Launchy to launch my app and Launchy is looking for my browser. Since I am using Nitrous.io, I do not have a browser installed, so Launchy does not know what to do.

The author of Launchy explains that "...launching a browser from within the virtual box would do nothing if there was no browser installed." https://github.com/copiousfreetime/launchy/issues/78

Launching manually appears to be my only option at this point.

brntsllvn
  • 931
  • 11
  • 18
  • Thanks for bringing the issue to my attention. I'll update the next version of the book to avoid the confusion. – Daniel Kehoe Oct 08 '14 at 05:04
  • Appreciate your help here. – brntsllvn Oct 08 '14 at 14:40
  • did you find an alternative? I'm trying to use `letter_opener` to visualize my emails in development with nitrous but it just gives me errors – Stephane Maarek Sep 11 '15 at 17:21
  • Short answer is...no. Funny enough, this issue with Launchy not working with Nitrous keeps rearing its ugly head almost a year later, particularly with testing using Capybara. Sorry I cannot be more helpful. – brntsllvn Sep 12 '15 at 00:52