tesla icon indicating copy to clipboard operation
tesla copied to clipboard

(FunctionClauseError) no function clause matching in :prim_inet.recv/3

Open phasnox opened this issue 7 years ago • 1 comments

Hello!

I'm getting the following error while trying to do a post to an endpoint:

** (FunctionClauseError) no function clause matching in :prim_inet.recv/3

    The following arguments were given to :prim_inet.recv/3:

        # 1
        #Port<0.12>

        # 2
        0

        # 3
        "60000"

    :prim_inet.recv/3
    (hackney) /opt/app/deps/hackney/src/hackney_response.erl:76: :hackney_response.wait_status/1
    (hackney) /opt/app/deps/hackney/src/hackney.erl:376: :hackney.send_request/2
    (tesla) lib/tesla/adapter/hackney.ex:70: Tesla.Adapter.Hackney.request/5
    (tesla) lib/tesla/adapter/hackney.ex:32: Tesla.Adapter.Hackney.call/2
    (tesla) lib/tesla/middleware/json.ex:53: Tesla.Middleware.JSON.call/3
    (tesla) lib/tesla/middleware/follow_redirects.ex:45: Tesla.Middleware.FollowRedirects.redirect/3
** (EXIT from #PID<0.440.0>) shell process exited with reason: shutdown

With the following client, request and opts:

client = %Tesla.Client{
  adapter: nil,
  fun: nil,
  post: [],
  pre: [
    {Tesla.Middleware.BaseUrl, :call, ["http://someurl:8085/api"]},
    {Tesla.Middleware.Headers, :call,
     [
       [
         "x-request-token": "4b033d63-ffb9-4c8b-8ed9-12bb1aed0e1a",
         "x-session-token": "38f2cd5b9b8e0e4e55ead09f990c6246",
       ]
     ]},
    {Tesla.Middleware.FollowRedirects, :call, [[]]},
    {Tesla.Middleware.JSON, :call, [[]]},
  ]
}

opts = [adapter: [recv_timeout: "60000"]]

request = %{ data: %{} }

client |> Tesla.post("/booking/book", request, opts: opts)

What could I be doing wrong? Tesla version is 1.3.0 and Hackney 1.13

phasnox avatar Nov 01 '19 15:11 phasnox

I was wrong. As you can see the recv_timeout is a String, it should be a Number.

phasnox avatar Nov 02 '19 02:11 phasnox