sean-connor

sean-connor

Gigalixir Deployment Issue - '53300 (too_many_connections)' followed by 'Authenticity is not established by certificate path validation'

Trying to deploy an existing app on Gigalixir and have had a bit of difficulty, but can’t find anything about how to resolve this current issue. It has no front end assets, it’s just an Absinthe GraphQL API.

This error occors:

 [error] Postgrex.Protocol (#PID<0.2308.0>) failed to connect: ** (Postgrex.Error) FATAL 53300 (too_many_connections) remaining connection slots are reserved for non-replication superuser connections

Followed by this warning:

[warn] Description: 'Authenticity is not established by certificate path validation' 

web.1  | Reason: 'Option {verify, verify_peer} and cacertfile/cacerts is missing'

I provisioned the database through the CLI as a Standard tier and set the pool size down to 2 as suggested by the troubleshooting docs for hitting the too_many_connections error.

Using Phoenix 1.6 / Elixir 1.12.3 / Erlang 24.2

config.exs:

import Config

config :evora,
  ecto_repos: [Evora.Repo],
  generators: [binary_id: true]

# Configures the endpoint
config :evora, EvoraWeb.Endpoint,
  url: [host: "localhost"],
  render_errors: [view: EvoraWeb.ErrorView, accepts: ~w(json), layout: false],
  pubsub_server: Evora.PubSub

prod.exs:

import Config

config :evora, Evora.Endpoint,
  load_from_system_env: true,
  http: [port: {:system, "PORT"}],
  server: true,
  secret_key_base: "${SECRET_KEY_BASE}",
  url: [host: "${APP_NAME}.gigalixirapp.com", port: 443],

releases.exs:

import Config
config :evora, EvoraWeb.Endpoint,
  server: true,
  http: [port: {:system, "PORT"}], # Needed for Phoenix 1.2 and 1.4. Doesn't hurt for 1.3.
  url: [host: System.get_env("APP_NAME") <> ".gigalixirapp.com", port: 443]

runtime.exs:

import Config
if config_env() == :prod do
  config :evora, Evora.Repo,
    adapter: Ecto.Adapters.Postgres,
    database: "",
    ssl: true,
    url: System.get_env("DATABASE_URL"),
    pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")

  secret_key_base =
    System.get_env("SECRET_KEY_BASE") ||
      raise """
      environment variable SECRET_KEY_BASE is missing.
      You can generate one by calling: mix phx.gen.secret
      """

  config :evora, EvoraWeb.Endpoint,
    http: [
      ip: {0, 0, 0, 0, 0, 0, 0, 0},
      port: String.to_integer(System.get_env("PORT") || "4000")
    ],
    secret_key_base: secret_key_base
end

elixir_buildpack.config

elixir_version=1.12.3
erlang_version=24.2

First Post!

jesse

jesse

Hi Sean,

Sometimes connections can take a little while to get cleaned up so my guess is lowering your pool size actually solved the issue, but took some time to clean up. Are you still seeing it even after waiting a little while?

For the certificate issue, ​I usually see this when the app is trying to make an HTTPS connection, but isn’t verifying the certificate. For example, if it’s configured with verify_none.
See No way to silence certificate path validation warning · Issue #5352 · erlang/otp · GitHub

Could that be what your app is doing? If not, perhaps you need to install certs. For example,
https://github.com/elixir-mint/castore

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
qwerescape
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
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call t...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
albydarned
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
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
jason.o
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
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54120 245
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement