Closed sezaru closed 3 years ago
@sezaru the error you get is a response, not the return value of Mint.HTTP.stream/2
or Mint.HTTP.recv/3
. The function clause error you pasted at the bottom shows you that it's happening not in the code that you pasted, but rather in the reduce_responses/3
function:
{:function_clause, [{Tesla.Adapter.Mint, :"-reduce_responses/3-fun-2-", [{:error, #Reference<0.3293968231.3493068809.17166>, %Mint.HTTPError{module: Mint.HTTP2, reason: {:server_closed_request, :internal_error}}} ...
I’m gonna close this issue as I’m pretty sure it's not an issue in Mint but please feel free to comment or reopen if you can't find the fix in Tesla.Adapter.Mint.reduce_responses/3
. :)
@sezaru actually that was pretty straightforward to find, here's the problem:
As you can see there's a clause missing for the {:error, ref, reason}
possible response (see https://hexdocs.pm/mint/1.2.1/Mint.Types.html#t:response/0).
Yep, you are right, I didn't see that the error was related to the response()
type instead of the tuple stream/2
and recv/3
receives.. I guess is not a good idea to open issues in Github at 2 AM :facepalm:
Mint's documentation tells that
HTTP.stream/2
andHTTP.recv/3
functions can receive errors in this format:{:error, t(), Mint.Types.error(), [Mint.Types.response()]}
But looking at my logs it seems that I actually receive an error that doesn't follow this structure:
Is the documentation incomplete regarding the possible return values of these functions?
More information:
I'm using
Mint
viaTesla
library, I got a:function_clause
error in this function:Where
receive_message
is:Because
Tesla
tries to match the response ofstream/2
andrecv/3
with the documented possible returns. But as described, I received another response that didn't match any of the cases.Here is the full error log in case it helps: