bumi / lnrpc

a gRPC client for the Lightning Network Daemin (LND) packed as rubygem
MIT License
18 stars 6 forks source link

rake assets:precompile breaks with no tls.cert #9

Closed ryan-lingle closed 5 years ago

ryan-lingle commented 5 years ago

I was trying to host a small app using this gem on Heroku and during the build ran into this error:

Running: rake assets:precompile
remote:        rake aborted!
remote:        Errno::ENOENT: No such file or directory @ rb_sysopen - /app/.lnd/tls.cert
remote:        /tmp/build_d0e548cbc598816263de2c4d04b9565e/vendor/bundle/ruby/2.4.0/gems/lnrpc-0.5.2/lib/lnrpc/client.rb:34:in `read'

The code in question is this line:

elsif File.exists?(::File.expand_path(options[:credentials_path] || DEFAULT_CREDENTIALS_PATH))
   self.credentials = ::File.read(::File.expand_path(options[:credentials_path] || DEFAULT_CREDENTIALS_PATH))
else

Even though that block won't ever be touched by the application, the precompile has to assume it will? Might have to be something where I have to edit the gem for my project specifically, but was wondering if you had a potential fix in mind?

Either way thanks!

ryan-lingle commented 5 years ago

I suppose I could just throw a dummy tls.cert in the directory. A little hacky, but could do the trick.

bumi commented 5 years ago

yeah, guess loading files by default is not a good idea that should probably be removed.

bumi commented 5 years ago

if you pass in a credentials and a macaroon option it should do the trick and not fallback to a default file it tries to load. if you use the latest version from master.

ryan-lingle commented 5 years ago

Awesome, thanks!