peter.bocian
Hi Elixir team! I am new to this forum. I currently moved to redis sentinel and although production is working fine I am having trouble getting my tests to pass. The error I am seeing is: ** (Mix) Could not start application scrivener: Scrivener.start(:normal, []) returned an error: shutdown: failed to start child: :worker ** (EXIT) an exception was raised: ** (MatchError) no match of right hand side value: {:error, {:EXIT, {%ArgumentError{message: "sentinel address should be specified as a URI or a keyword list, got: nil"}, [{Redix.StartOptions, :normalize_sentinel_address, 2, [file: 'lib/redix/start_options.ex', line: 122]}, {Enum, :"-map/2-lists^map/1-0-", 2, [file: 'lib/enum.ex', line: 1411]}, {Redix.StartOptions, :sanitize_sentinel_opts, 1, [file: 'lib/redix/start_options.ex', line: 79]}, {Redix.StartOptions, :maybe_sanitize_sentinel_opts, 1, [file: 'lib/redix/start_options.ex', line: 68]}, {Redix.StartOptions, :sanitize, 1, [file: 'lib/redix/start_options.ex', line: 51]}, {Redix.Connection, :start_link, 1, [file: 'lib/redix/connection.ex', line: 25]}, {:supervisor, :do_start_child_i, 3, [file: 'supervisor.erl', line: 385]}, {:supervisor, :handle_call, 3, [file: 'supervisor.erl', line: 410]}]}}} (poolboy 1.5.1) src/poolboy.erl:275: :poolboy.new_worker/1 . My test.exs is set up exactly like my prod.exs => ```config :scrivener, Scrivener.Endpoint,
http: [:inet6, port: {:system, “PORT”}],
server: false
Do not print debug messages in production
config :logger, level: :warn
Pull Redis sentinel settings from environment variables
{ redis_pool_size, original_value } = (System.get_env(“REDIS_POOL_SIZE”) || “5”) |> Integer.parse
{ redis_max_overflow, original_value } = (System.get_env(“REDIS_MAX_OVERFLOW”) || “2”) |> Integer.parse
{ redis_sentinel_timeout, original_value } = (System.get_env(“REDIS_SENTINEL_TIMEOUT”) || “10000”) |> Integer.parse
config :redix,
pool_size: redis_pool_size,
max_overflow: redis_max_overflow,
sentinel: [
sentinels: [
System.get_env(“REDIS_SENTINEL_HOST_A”),
System.get_env(“REDIS_SENTINEL_HOST_B”),
System.get_env(“REDIS_SENTINEL_HOST_C”)
],
group: System.get_env(“REDIS_SENTINEL_GROUP”),
timeout: redis_sentinel_timeout
]```. I can see it is a redix issue but not sure how to resolve.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
al2o3cr
I suspect one of these environment variables isn’t set, that would explain finding a
nilinsentinelspeter.bocian
Thanks for the fast reply. By checking my environment variables, I have them connected and they are working in production. I am wondering if it could be a gem/version thing for mix? REDIS_SENTINEL_HOST_A=redis://sentinel004…
REDIS_SENTINEL_HOST_B=redis://sentinel005…
REDIS_SENTINEL_HOST_C=redis://sentinel006…
al2o3cr
Try inspecting the values in the config; something is not making it to
Redix.peter.bocian
Thank you
. It looks like when printing they were coming in as null. I hardcoded redis sentinel endpoints and following error: {%ArgumentError{message: “a host should be specified for each sentinel”}. When looking in redix docs, I see {Redix supports Redis Sentinel by passing a
:sentineloption to
start_link/1(orstart_link/2) instead of:hostand:port.}. Which is how it looks like I set it up.vschroeder
It is unclear from the last message if you managed to solve this issue or not, but the fact that your settings were printed as
nilwould indicate that you tried to set the values using environment variables during runtime, hoping that they would be injected in the config. However, that code that is actually executed at compile-time.You mentioned the injection of these variables in your
config/test.exsandconfig/prod.exsreinforces my impression. Most likely, you have such variables correctly set in your test suite, but you most certainly don’t have them when compiling your code for production. Both config files mentioned above are only executed during compile-time, and therefor, only use the environment variables available at that point in time. Setting these variables later, when running the application, is irrelevant.The only config file executed during runtime is
config/releases.exs, but obviously only in the context of a release, which is what you should be running in production anyway.