dvadell1
:ssl.connect() always returns :socket_options error!
Hi!
What is the right way of calling the :ssl.connect() ? From Examples — OTP 29.0.2 (ssl 11.7.2) it looks like it should be:
:ssl.start()
:ssl.connect("google.com", 443, [{:verify, :verify_peer},{:cacerts, :public_key.cacerts_get()}])
But no matter what host or options I try, I get the same:
Interactive Elixir (1.14.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :ssl.start()
:ok
iex(2)> :ssl.connect("google.com", 443, [{:verify, :verify_peer}, {:cacerts, :public_key.cacerts_get()} ])
{:error,
{:options,
{:socket_options,
[packet_size: 0, packet: 0, header: 0, active: false, mode: :binary]}}}
Does anyone know what am I doing wrong?
Thanks!
Marked As Solved
kip
ex_cldr Core Team
Since :ssl is an erlang lib I expect you would need to put the URL in single quotes for Elixir, like 'google.com'. That may not be the source of the error you are seeing but it might help.
1
Also Liked
benwilson512
Author of Craft GraphQL APIs in Elixir with Absinthe
Yup
iex(3)> :ssl.connect("google.com", 443, [{:verify, :verify_peer},{:cacerts, :public_key.cacerts_get()}])
{:error,
{:options,
{:socket_options,
[packet_size: 0, packet: 0, header: 0, active: false, mode: :binary]}}}
iex(4)> :ssl.connect('google.com', 443, [{:verify, :verify_peer},{:cacerts, :public_key.cacerts_get()}])
{:ok,
{:sslsocket, {:gen_tcp, #Port<0.7>, :tls_connection, :undefined},
[#PID<0.244.0>, #PID<0.243.0>]}}
It’s a common gotcha when transliterating code from Erlang to Elixir.
2
dvadell1
Thanks!! That was exactly it! ![]()
1
Popular in Questions
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)?
Would
mix ecto.rollback -v 200809061...
New
Hello, how can I check the Phoenix version ?
Thanks !
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Other popular topics
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including.
What is Phoenix LiveV...
New
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
New








