Vonage / vonage-ruby-sdk

Vonage REST API client for Ruby. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
https://developer.vonage.com
Apache License 2.0
218 stars 105 forks source link

http proxy support is broken in 7.21+ #317

Open profforg opened 3 days ago

profforg commented 3 days ago

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)
superchilled commented 2 days ago

Hi @profforg can you provide some more detail about this issue? E.g. the specific steps which led to the error? Thanks!

profforg commented 2 days ago

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:)
superchilled commented 1 day ago

@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.