socketry/async-http

Wrong number of arguments writing stream headers

Closed this issue · 3 comments

Hi, I'm seeing this error when trying to make a simple POST request using async-http. It works fine if I explicitly pin 'protocol-http2', '~> 0.20.0', so seems like this library is not compatible with the latest 0.22.0 version of that dependency.

/Users/telkins/.rvm/gems/ruby-3.2.2/gems/protocol-http2-0.22.0/lib/protocol/http2/stream.rb:128:in `write_headers': wrong number of arguments (given 3, expected 1..2) (ArgumentError)
        from /Users/telkins/.rvm/gems/ruby-3.2.2/gems/protocol-http2-0.22.0/lib/protocol/http2/stream.rb:145:in `send_headers'
        from /Users/telkins/.rvm/gems/ruby-3.2.2/gems/async-http-0.83.1/lib/async/http/protocol/http2/response.rb:225:in `send_request'
        from /Users/telkins/.rvm/gems/ruby-3.2.2/gems/async-http-0.83.1/lib/async/http/protocol/http2/client.rb:45:in `write_request'
        from /Users/telkins/.rvm/gems/ruby-3.2.2/gems/async-http-0.83.1/lib/async/http/protocol/http2/client.rb:38:in `call'
        from /Users/telkins/.rvm/gems/ruby-3.2.2/gems/protocol-http-0.47.0/lib/protocol/http/request.rb:87:in `call'
        from /Users/telkins/.rvm/gems/ruby-3.2.2/gems/async-http-0.83.1/lib/async/http/client.rb:146:in `make_response'
        from /Users/telkins/.rvm/gems/ruby-3.2.2/gems/async-http-0.83.1/lib/async/http/client.rb:104:in `call'
        from /Users/telkins/.rvm/gems/ruby-3.2.2/gems/protocol-http-0.47.0/lib/protocol/http/middleware.rb:53:in `call'
        from /Users/telkins/.rvm/gems/ruby-3.2.2/gems/protocol-http-0.47.0/lib/protocol/http/accept_encoding.rb:47:in `call'
        from /Users/telkins/.rvm/gems/ruby-3.2.2/gems/async-http-0.83.1/lib/async/http/internet.rb:51:in `call'
        from /Users/telkins/.rvm/gems/ruby-3.2.2/gems/async-http-0.83.1/lib/async/http/internet.rb:72:in `block (2 levels) in <class:Internet>'

Specifically it looks like this:

if request.body.nil?
	@stream.send_headers(nil, headers, ::Protocol::HTTP2::END_STREAM)
else

eventually makes its way down to private def write_headers(headers, flags = 0) hence the wrong number of arguments.

Sorry about this. This is due to a recent change in HTTP priority implementation.

Can you please update to the latest async-http version? That should fix the issue.

Sorry missed that a newer version was available, seems fixed in 0.86.0 now. 🎉

Awesome. For the record, if I release a breaking change in one gem, I make sure the other gems are released first with any compatibility shims, if you do bundle update it should never break, because both gems would be updated. However, if you only update one gem (or pin something) then it can be an issue.

That being said, I also try to avoid doing this and for sure it's only something I'd do with 0.x releases.