unixcharles / acme-client

A Ruby client for the letsencrypt's ACME protocol.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NoMethodError: undefined method `URI' for #<Acme::Client:0x0056023f1c6c80>

onknows opened this issue · comments

commented

Following the README produces something like below on my machine. Strange.

[ostraaten:~/tmp] $ ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
[ostraaten:~/tmp] $ gem list | grep acme
acme-client (2.0.0)
[ostraaten:~/tmp] $ irb
irb(main):001:0> require 'openssl'
=> true
irb(main):002:0> require 'acme-client'
=> true
irb(main):003:0> private_key = OpenSSL::PKey::RSA.new(4096)
=> #<OpenSSL::PKey::RSA:0x0056023f1e7070>
irb(main):004:0> client = Acme::Client.new(private_key: private_key, directory: 'https://acme-staging-v02.api.letsencrypt.org/directory')
NoMethodError: undefined method `URI' for #<Acme::Client:0x0056023f1c6c80>
	from /opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/acme-client-2.0.0/lib/acme/client.rb:43:in `initialize'
	from (irb):4:in `new'
	from (irb):4
	from /opt/rbenv/versions/2.2.2/bin/irb:11:in `<main>'
irb(main):005:0> 
commented

require 'uri' is missing?

You are right, uri is not explicitly require.

Its working for me locally using ruby 2.4.4p296

$ irb                    
irb(main):001:0> require 'acme-client'
=> true
irb(main):002:0> private_key = OpenSSL::PKey::RSA.new(4096)
=> #<OpenSSL::PKey::RSA:0x00007ff44d139f90>
irb(main):003:0> client = Acme::Client.new(private_key: private_key, directory: 'https://acme-staging-v02.api.letsencrypt.org/directory')
=> #<Acme::Client:0x00007ff44d1228e0 @jwk=#<Acme::Client::JWK::RSA:0x00007ff44d122868 @private_key=#<OpenSSL::PKey::RSA:0x00007ff44d139f90>>, @connection_options={}, @kid=nil, @directory=#<Acme::Client::Resources::Directory:0x00007ff44d122660 @url=#<URI::HTTPS https://acme-staging-v02.api.letsencrypt.org/directory>, @connection_options={}>, @nonces=[]>
irb(main):004:0>

Probably because a version of my dependency must requiring it. I will add an explicit require for this.

Just out of curiosity, what version of Faraday are you using?

commented

Faraday? I don't know? What is Faraday? Am I using it?

It should be in the constant Faraday::VERSION