Plugin install fails on downloaded (non-gem) Heroku Toolbelt #3

Closed
zeke opened this Issue Aug 11, 2012 · 20 comments

Comments

Projects
None yet
8 participants

zeke commented Aug 11, 2012

No problems on 1.9.2 on the same machine.

~/Projects/personal/queriac/queriac2 master >heroku plugins:install https://github.com/papertrail/papertrail-heroku-plugin
Installing papertrail-heroku-plugin... failed
 !    Unable to load plugin papertrail-heroku-plugin..
 !    Search for help at: https://help.heroku.com
 !    Or report a bug at: https://github.com/heroku/heroku/issues/new

    Error:       papertrail gem is missing. Please install papertrail: gem install papertrail (RuntimeError)
    Backtrace:   /Users/zeke/.heroku/plugins/papertrail-heroku-plugin/init.rb:4
                 /Users/zeke/.heroku/client/lib/heroku/plugin.rb:64:in `load'
                 /Users/zeke/.heroku/client/lib/heroku/plugin.rb:64:in `load_plugin'
                 /Users/zeke/.heroku/client/lib/heroku/command/plugins.rb:46:in `install'
                 /usr/local/heroku/lib/heroku/helpers.rb:232:in `action'
                 /Users/zeke/.heroku/client/lib/heroku/command/plugins.rb:44:in `install'
                 /Users/zeke/.heroku/client/lib/heroku/command.rb:179:in `send'
                 /Users/zeke/.heroku/client/lib/heroku/command.rb:179:in `run'
                 /Users/zeke/.heroku/client/lib/heroku/cli.rb:25:in `start'
                 /usr/bin/heroku:25

    Command:     heroku plugins:install https://github.com/papertrail/papertrail-heroku-plugin
    Plugins:     heroku-production-check
                 heroku-sudo
                 papertrail-heroku-plugin

    Version:     heroku-toolbelt/2.30.2 (universal-darwin11.0) ruby/1.8.7

~/Projects/personal/queriac/queriac2 master >gem list | grep paper
delayed_paperclip (0.7.2)
paperclip (2.3.16, 2.3.15)
papertrail (0.9.3)
~/Projects/personal/queriac/queriac2 master >ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
Contributor

troy commented Aug 11, 2012

Hey Zeke, sorry about the problem and thanks for the great detail. We'll regress this and should have an update (and questions or a fix) next week.

@ghost ghost assigned eric Aug 11, 2012

same issue here

Contributor

troy commented Aug 29, 2012

Thanks @zeke and @wrburgess. We're regressing and hope to have an update or specific questions about your environments later this week.

Any update on this? I'm having the same problem.

I'm having this same issue. Was this ever resolved?

shinzui commented Jan 31, 2013

It works with the homebrew version of the heroku toolbelt, but not with the one provided on the heroku site.

Same issue here. Not a great first 15 minutes so far with papertrail.

Contributor

troy commented Apr 5, 2013

I agree completely, @jaredbeck. It sucks, and if there was a painless fix, we'd have made it immediately. We're going to see what we can come up with, though. Appreciate the ping.

Contributor

troy commented Apr 7, 2013

Update that we have a repro on this and I expect to have a fix next week. Here's the longer explanation

Initially we couldn't repro it on ruby 1.9 or 1.8 (except when the papertrail gem actually wasn't installed, of course). After more testing, it only occurs with the standalone toolbelt installer, not when the toolbelt is installed with gem install heroku (or at least heroku-gem/2.37.2 works as expected and heroku-toolbelt/2.37.2 doesn't; based on the information below, I'm confident that's the difference).

After looking through the package, this is the difference. It's also why gem list papertrail is meaningless when heroku is installed from a package instead of from the gem. The only gems that a packager-installed heroku loads are those vendored into its local ruby in /usr/local/heroku/vendor/, not the ones available to the gem loaded in the shell environment.

Plugins are installed in ~/.heroku/plugins, so they can't drop files into vendor/. However, it looks like plugins can effectively vendor other gems by distributing them in lib/ (see here) or by making init.rb install them.

We'll update this issue again next week with a resolution.

The only gems that a packager-installed heroku loads are those vendored into its local ruby in /usr/local/heroku/vendor/, not the ones available to the gem loaded in the shell environment.

Well, that's odd. Perhaps heroku was concerned about protecting its gem dependencies. Thanks for the followup.

Contributor

troy commented Apr 10, 2013

Update that vendoring the gems it depends on is complicated by platform-specific gems (such as yajl-ruby). I've asked Heroku whether they have any suggestions how to handle this. I'll continue to update this issue until I have a conclusive resolution or fix.

Contributor

troy commented Apr 13, 2013

Update that the workaround is to not use gems which have native code (and thus platform-specific gem versions). We're seeing how hard it is to rework the plugin's HTTP client (currently faraday) to use okjson (which ships with Heroku's Ruby) instead of yajl (does not and has native code).

@troy troy referenced this issue in papertrail/papertrail-cli Aug 21, 2013

Closed

Use Net::HTTP and okjson instead of Faraday and YAJL #27

Contributor

troy commented Mar 10, 2014

FYI, we moved the CLI app to a native JSON API to fix this, so Papertrail's Heroku plugin now works with both the heroku gem and heroku-toolbelt. https://github.com/papertrail/papertrail-heroku-plugin has installation instructions.

@troy troy closed this Mar 10, 2014

Not working for me .. not sure what I'm missing.

$ gem install papertrail
Successfully installed papertrail-0.9.8
1 gem installed

$ gem which papertrail
/Users/jared/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/papertrail-0.9.8/lib/papertrail.rb

$ heroku plugins:install https://github.com/papertrail/papertrail-heroku-plugin
Installing papertrail-heroku-plugin... failed

    Error:       papertrail gem is missing. Please install papertrail: gem install papertrail (RuntimeError)
    Backtrace:   /Users/jared/.heroku/plugins/papertrail-heroku-plugin/init.rb:4:in `rescue in <top (required)>'
                 /Users/jared/.heroku/plugins/papertrail-heroku-plugin/init.rb:1:in `<top (required)>'
                 /Users/jared/.heroku/client/lib/heroku/plugin.rb:71:in `load'
                 /Users/jared/.heroku/client/lib/heroku/plugin.rb:71:in `load_plugin'
                 /Users/jared/.heroku/client/lib/heroku/command/plugins.rb:46:in `block in install'
                 /Users/jared/.heroku/client/lib/heroku/helpers.rb:227:in `action'
                 /Users/jared/.heroku/client/lib/heroku/command/plugins.rb:44:in `install'
                 /Users/jared/.heroku/client/lib/heroku/command.rb:218:in `run'
                 /Users/jared/.heroku/client/lib/heroku/cli.rb:28:in `start'
                 /usr/local/heroku/bin/heroku:24:in `<main>'

    Command:     heroku plugins:install https://github.com/papertrail/papertrail-heroku-plugin
    Plugins:     heroku-accounts
                 heroku-pg-extras
                 papertrail-heroku-plugin

    Version:     heroku-toolbelt/3.6.0 (x86_64-darwin10.8.0) ruby/1.9.3
Contributor

troy commented Mar 15, 2014

@jaredbeck Wow, that's a fun one. After a fair amount of hunting, I was able to repro it. The gist is that rvm sets my shell's GEM_HOME and GEM_PATH and makes basically every command I run un-representative of a stock install. I'd been verifying that I had un-tainted load paths with LOAD_PATH, which is documented as the current load path. However, the behavior is silently tainted with GEM_ variables. Other than remembering to check for these variables, they're basically invisible other than using strace, dtruss, or the like to trace the open() on the module file.

I'll fix this and post an update here when the new plugin is available, probably next week.

@troy troy assigned troy and unassigned eric Mar 15, 2014

Wow, that's a fun one. After a fair amount of hunting, I was able to repro it.

Thanks @troy. The repro is always the hardest part, isn't it.

As I'm sure you know, rbenv is a common alternative to rvm, so you'll want to test against a rbenv box too. Just beware that the two cannot coexist. If you don't have an rbenv box to test on, I recommend setting up a VM with something like virtualbox and vagrant. Good luck and thanks.

PS: There's also chruby

Contributor

troy commented Mar 17, 2014

I'll do even better: test against pure, unadulterated Ruby. There's nothing unusual about how this module is loaded, and I doubt that any of the Ruby VM managers break require :-)

Contributor

troy commented Mar 25, 2014

@jaredbeck and anyone else, this should be good to go. heroku plugins:install and you'll be on your way. It's self-contained. Enjoy!

Install worked for me. Thanks Troy! ❤️

Contributor

troy commented Mar 26, 2014

My pleasure, and thanks right back! Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment