Nezteb

Nezteb

When starting Elixir application, I get the “errors” screenshotted below. This is a basic Phoenix application that has been working fine for me up until recently.

Elixir: 1.14.1-otp-25
Erlang: 25.1.1
Postgres: postgis/postgis:13-3.1

The redacted part is just an app-specific environment variable; MIX_ENV is set to dev. As far as I know SSL shouldn’t be used; I don’t have any special config options set anywhere, neither in the mix project nor Postgres itself.

The most relevant Google result for this error message is this GitHub issue: SSL not available · Issue #387 · elixir-ecto/postgrex · GitHub

Things I’ve tried:

  • Running :ssl.start in an iex session returns :ok as suggested in the GitHub issue.
  • Adding an explicit ssl: false config to my repo.
  • Adding :ssl to the Mix project’s extra_applications list.

So far nothing seem to work. The only other relevant thing I can think to mention is that I’m on an M2 macOS laptop; I’ve tried running Postgres with both Docker Desktop and locally using Postgres.app, but both give me the same errors.

Any ideas would be greatly appreciated! :smiley:

Showing Posts 1 to 4

whatyouhide

whatyouhide

Elixir Core Team

Where you say it “clearly works” in the screenshot, that’s not really true: your application starts, but the Postgrex processes log some errors. The application can run even if the Postgrex processes are down, which is normal if you’re following a sort of standard setup, with your Ecto.Repo as a child of the application supervision tree.

As for the SSL, it’s hard to debug this without seeing any of the configuration you’re using. What address are you using to connect to Postgres?

al2o3cr

al2o3cr

As one of the replies on that issue calls out, the message isn’t related to the Elixir SSL machinery: it’s caused by the Postgres server replying N to an SSLRequest message. The Postgrex implementation:

https://github.com/elixir-ecto/postgrex/blob/d888ae474cfcf2ac2a4cb353af45df65cdb8b7e5/lib/postgrex/protocol.ex#L722-L743

I would expect that setting ssl: false in the configuration would avoid this, though. :thinking:

Nezteb

Nezteb OP

Address: postgres://postgres:postgres@localhost:5432/my_app_dev

As far as config, there’s a lot of application-specific config, but here is the repo config:

config :my_app, MyApp.Repo,
  username: "postgres",
  password: "postgres",
  database: "my_app_dev",
  hostname: "localhost",
  show_sensitive_data_on_connection_error: true,
  pool_size: 10

The reason I say the app “clearly works” (which I realize I didn’t mention) is because mix ecto.setup/mix ecto.reset works. Migrations run just fine, my seeds.exs successfully seeds data (I can see the seed data in the database tables themselves). Most of the tests (many of which use the database) also pass. Some tests do fail though, with:

  5) test things should work (MyApp.Resolvers.ThingResolverTest)
     test/my_app_web/resolvers/thing_resolver_test.exs:110
     ** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 11266ms. This means requests are coming in and your connection pool cannot serve them fast enough. You can address this by:
     
       1. Ensuring your database is available and that you can connect to it
       2. Tracking down slow queries and making sure they are running fast enough
       3. Increasing the pool_size (although this increases resource consumption)
       4. Allowing requests to wait longer by increasing :queue_target and :queue_interval
     
     See DBConnection.start_link/2 for more information
     
     stacktrace:
       (db_connection 2.4.2) lib/db_connection/ownership.ex:96: DBConnection.Ownership.ownership_checkout/2
       (ecto_sql 3.9.0) lib/ecto/adapters/sql/sandbox.ex:500: Ecto.Adapters.SQL.Sandbox.checkout/2
       (my_app 0.1.0) test/support/data_case.ex:33: MyApp.DataCase.__ex_unit_setup_0/1
       (my_app 0.1.0) test/support/data_case.ex:1: MyApp.DataCase.__ex_unit__/2
       test/my_app_web/api/resolvers/thing_resolver_test.exs:1: MyAppWeb.Resolvers.ThingResolverTest.__ex_unit__/2

But then after waiting a bit and running mix test --failed, those same tests pass.

Nezteb

Nezteb OP

Turns out I misunderstood some of the application I’m working on!

It has a config for an AWS Redshift repo, but it was supposedly disabled when running locally. Despite that, the application.ex file will still try to start up the Redshift connection regardless of the value in the config file.

So now I’ve added a helper in the application children list like so:

# An application children helper function
defp common_backend_children(mode) do
  [
    # ...
    maybe_enable_redshift(),
    # ...
  ]
  |> Enum.reject(&is_nil/1)
end

defp maybe_enable_redshift() do
  # cfg!/1 is a configuration helper that reads a YAML file for extra config
  if cfg!([:redshift, :enabled]) do
    MyApp.RedshiftRepo
  else
    nil
  end
end

Sooooooo disregard this entire thread. :smiley: Thanks for all of the help!

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews