http proxy support is broken in 7.21+
After switching HTTP adapter from Net::HTTP to Net::HTTP::Persistent proxy support is broken:
WARN: TypeError: Parameter 'http': Expected type Net::HTTP, got type Net::HTTP::Persistent with hash 2926599207967444236
Caller: /opt/vendor/bundle/ruby/3.3.0/gems/vonage-7.26.0/lib/vonage/namespace.rb:18
Definition: /opt/vendor/bundle/ruby/3.3.0/gems/vonage-7.26.0/lib/vonage/http.rb:25 (Vonage::HTTP::Options#set)
Hi @profforg can you provide some more detail about this issue? E.g. the specific steps which led to the error? Thanks!
The http proxy credentials are passed when the client instance is initialized (since the system proxy settings from ENV are ignored) and when I try to send SMS I get this error
example code:
client = Vonage::Client.new(
http: {
proxy_address: ENV.fetch('VONAGE_PROXY_ADDR', nil),
proxy_port: ENV.fetch('VONAGE_PROXY_PORT', nil) },
api_key: ENV.fetch('VONAGE_API_KEY', nil),
api_secret: ENV.fetch('VONAGE_API_SECRET', nil)
)
client.sms.send(from:, to: phone:, text:, type:, callback:)
@profforg I think I've identified the cause of the issue (actually, there are two separate, but related, underlying issues). I just need to investigate/test a bit more before pushing a fix. I'm aiming to release an update with a fix for this issue early next week.
@profforg setting HTTP options is fixed in this release.
Note: some of the available options on Net::HTTP::Persistent are different from the ones on Net::HTTP (event though Net::HTTP::Persistent uses Net:HTTP under the hood). For example, there is a single setter for proxy rather than separate setters for proxy_address and proxy_port. See Rubydoc for more info.