phoenixframework/phoenix_pubsub_redis

Error when passing socket_opts: [verify: :verify_none]

Closed this issue · 2 comments

bmfay commented

I am attempting to disable certification "by passing verify: :verify_none in the socket options" as outlined in the Redix docs, however, specifying the following

{
        Phoenix.PubSub,
        socket_opts: [ verify: :verify_none ]
        name: Flow.PubSub,
        node_name: "something",
        adapter: Phoenix.PubSub.Redis,
        url: System.get_env("REDIS_URL") 
      }

in the Supervision tree results in

** (ArgumentError) argument error
    (kernel 6.5.1) gen_tcp.erl:168: :gen_tcp.connect/4
    (redix 1.1.5) lib/redix/connector.ex:33: Redix.Connector.connect_directly/3
    (redix 1.1.5) lib/redix/socket_owner.ex:43: Redix.SocketOwner.handle_info/2
    (stdlib 3.11) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib 3.11) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib 3.11) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: :connect
State: %Redix.SocketOwner{conn: #PID<0.12800.0>, continuation: nil, opts: [sync_connect: false, backoff_initial: 500, backoff_max: 30000, exit_on_disconnection: false, timeout: 5000, ssl: false, socket_opts: [verify: :verify_none], password: "{REDACTED}", host: '{REDACTED]', port: 27899], queue_table: #Reference<0.3807523016.2488139780.171396>, socket: nil, transport: :gen_tcp}

Seems like socket_opts is passing through fine so I am not sure why it's blowing up.

Top of the stack trace is https://github.com/erlang/otp/blob/master/lib/kernel/src/gen_tcp.erl#L168

Any leads appreciated, thank you.

bmfay commented

Update: Silly me, I needed to explicitly pass ssl: true. It's kind of surprising it just totally blows up if you don't, but I guess that's reasonable!

If you have time I’d love a PR that raises a better error. Thanks!