phoenixframework / phoenix_pubsub_redis

The Redis PubSub adapter for the Phoenix framework
175 stars 66 forks source link

Don't use defaults when `:sentinel` is set #60

Open fuelen opened 2 years ago

fuelen commented 2 years ago

redix doesn't allow to connect to sentinel when host or password is set: https://github.com/whatyouhide/redix/blob/44638994386a9372c2a270f8faba66d57c58f758/lib/redix/start_options.ex#L83-L85

barttenbrinke commented 1 year ago

For people googling this issue, this is the error you will see:

returned an error: shutdown: failed to start child: Phoenix.PubSub.Supervisor
    ** (EXIT) shutdown: failed to start child: Phoenix.PubSub.Redis
            ** (EXIT) shutdown: failed to start child: Phoenix.PubSub.RedisServer
                        ** (EXIT) an exception was raised:
                                        ** (ArgumentError)
:host or :port can't be passed as option if :sentinel is used
                    (redix 1.2.0) lib/redix/start_options.ex:84: Redix.StartOptions.sanitize_sentinel_opts/2
                                        (redix 1.2.0) lib/redix/start_options.ex:56: Redix.StartOptions.maybe_sanitize_sentinel_opts/1
                                                            (redix 1.2.0) lib/redix/start_options.ex:39: Redix.StartOptions.sanitize/1
                                                                                (redix 1.2.0) lib/redix/pubsub.ex:317: Redix.PubSub.start_link/1
                                                                                                    (phoenix_pubsub_redis 3.0.1) lib/phoenix_pubsub_redis/redis_server.ex:133: Phoenix.PubSub.RedisServer.establish_conn/1
                                                                                                                        (phoenix_pubsub_redis 3.0.1) lib/phoenix_pubsub_redis/redis_server.ex:67: Phoenix.PubSub.RedisServer.init/1