hyper
hyper copied to clipboard
Openssl EOF error
I am using dream to call hyper to make requests to Turso over http. When I send get or post requests, I get this:
27.02.24 05:51:45.557 dream.log INFO REQ 1 GET /turso/get 127.0.0.1:46574 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTM6
27.02.24 05:51:45.635 dream.log WARN REQ 1 Aborted by: SSL connection() error: error:14:000126:SSL routines::unexpected eof while reading
27.02.24 05:51:45.635 dream.log WARN Raised by primitive operation at Ssl in file "src/ssl.ml", line 785, characters 14-33
27.02.24 05:51:45.635 dream.log WARN Called from Lwt_ssl.wrap_call in file "src/lwt_ssl.ml", line 47, characters 4-8
27.02.24 05:51:45.635 dream.log WARN Re-raised at Lwt_ssl.wrap_call in file "src/lwt_ssl.ml", line 57, characters 7-14
27.02.24 05:51:45.635 dream.log WARN Called from Lwt_unix.retry_syscall in file "src/unix/lwt_unix.cppo.ml", line 509, characters 13-24
27.02.24 05:51:45.635 dream.log WARN Re-raised at Hyper__http__Connect.alpn_https_tcp.(fun) in file "src/http/connect.ml", line 90, characte0
27.02.24 05:51:45.635 dream.log WARN Re-raised at Hyper__http__Connect.no_pool.(fun) in file "src/http/connect.ml", line 165, characters 2-85
27.02.24 05:51:45.635 dream.log WARN Re-raised at Hyper__logic__Redirect.follow_redirect.redirect_loop.(fun) in file "src/logic/redirect.ml"3
27.02.24 05:51:45.635 dream.log WARN Re-raised at Dune__exe__Turso.promise_get.(fun) in file "src/turso.ml", line 28, characters 4-325
27.02.24 05:51:45.635 dream.log WARN Re-raised at Dune__exe__Main.(fun) in file "src/main.ml", line 51, characters 12-114
27.02.24 05:51:45.635 dream.http ERROR REQ 1 SSL connection() error: error:14:000126:SSL routines::unexpected eof while reading
27.02.24 05:51:45.635 dream.http ERROR REQ 1 Raised at Stdlib__Map.Make.find in file "map.ml", line 141, characters 10-25
27.02.24 05:51:45.635 dream.http ERROR REQ 1 Called from Logs.Tag.find in file "src/logs.ml", line 154, characters 14-32
My router code looks like this:
let () =
run ~port:3000
@@ logger
@@ router [
get "/turso/get" (fun _ ->
let%lwt str = Turso.hrana_support in
str |> Dream.html
);
]
;;
Where my Turso module looks like this:
let url =
match Sys.getenv_opt "TURSO_URL" with
| Some value -> value
| None -> failwith "TURSO_URL environment variable must be set."
;;
let hrana_support =
let request =
Hyper.request ~method_:`GET @@ url ^ "/v2"
in
let%lwt response = Hyper.run request in
if Dream_pure.Message.status response = `OK then
Hyper.body response
else
let%lwt () = Dream_pure.Message.close (Dream_pure.Message.client_stream response) in
Lwt.fail (Hyper.Response response)
;;
The versions of my environment are: Ocaml compiler: 5.1.1 openssl: 3.2.1 dune: 3.14
Let me know what more information is required. Thanks!
Hey @ethanthoma ! Did you manage to find a workaround for this? I'm using Cohttp for requests, and getting the same error every now and then.
@Ali-7CC Lol nope. I wrote my turso connections using golang and compiled to c and used dune to connect it. You can see here