madasebrof

madasebrof

Man. No idea what’s going on.

Somehow, a very stable postgrex config just seemed to stop working.

I isolated it to a new, empty project to test config…

I can connect to cockroach db via psql no problem, but no so much via postgrex.

config = [
  username: System.get_env("CDB_USERNAME"),
  password: System.get_env("CDB_PASSWORD"),
  database: System.get_env("CDB_DATABASE"),
  parameters: [options: System.get_env("CDB_OPTIONS")],
  hostname: System.get_env("CDB_HOSTNAME"),
  port: String.to_integer(System.get_env("CDB_PORT")),
  ssl: [cacertfile: Path.expand("priv/certs/ca-cert.crt")],
  stacktrace: true,
  show_sensitive_data_on_connection_error: true
]

[
  username: "*******",
  password: "**************",
  database: "************",
  parameters: [options: "--cluster=*****"],
  hostname: "*****.aws-us-east-1.cockroachlabs.cloud",
  port: 26257,
  ssl: [cacertfile: "/Users/***/dev/***/***/priv/certs/ca-cert.crt"],
  stacktrace: true,
  show_sensitive_data_on_connection_error: true
]

Postgrex.start_link(config)

I get this error:

{:ok, #PID<0.215.0>}

15:40:42.385 [error] :gen_statem #PID<0.217.0> terminating
** (ArgumentError) errors were found at the given arguments:

  * 1st argument: not a binary

    (stdlib 6.2) :binary.copy(nil)
    (postgrex 0.19.3) lib/postgrex/types.ex:137: Postgrex.Types.build_type_info/1
    (postgrex 0.19.3) lib/postgrex/protocol.ex:1134: Postgrex.Protocol.bootstrap_recv/4
    (postgrex 0.19.3) lib/postgrex/protocol.ex:729: Postgrex.Protocol.handshake/3
    (postgrex 0.19.3) lib/postgrex/protocol.ex:209: Postgrex.Protocol.connect_endpoints/6
    (db_connection 2.7.0) lib/db_connection/connection.ex:74: DBConnection.Connection.handle_event/4
    (stdlib 6.2) gen_statem.erl:3737: :gen_statem.loop_state_callback/11
    (stdlib 6.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Queue: [internal: {:connect, :init}]
Postponed: []
State: Postgrex.Protocol
Callback mode: :handle_event_function, state_enter: false

I’ve confirmed that the all the envs are fine, I also used env vars to connect via psql. Also, the cert file is readable, if I change that I get a cert file error.

Any thoughts or clue as to how to troubleshoot would be most appreciated!

As I said, this has been stable for months. I have no idea what could have changed.

Showing Posts 1 to 4

garrison

garrison

Looks like something in the protocol - I’m sure someone who works on Postgrex can comment on what this code does (I haven’t the slightest), but:

It sounds like you’re using Cockroach’s hosted cloud product, and you haven’t changed anything about your setup, right? So it sounds like they probably deployed a new version and broke something. If that’s the case, perhaps you should consider contacting their support to let them know? You’re probably not the only one.

That is, of course, assuming it’s not something really weird (like a crash induced by parsing a particular date which happened to be today, or something).

garrison

garrison

lol I found it reading their release notes, looks like it’s already patched on stable

https://github.com/cockroachdb/cockroach/pull/137941

Ask them to upgrade your cluster I guess?

madasebrof

madasebrof OP

Wacky that I can connect using psql! Thanks for this reply!

garrison

garrison

I didn’t read too closely but I think they broke the protocol in a way that didn’t affect most clients but happened to affect Postgrex (maybe others? who knows).

They probably only tested their changes on more popular clients.

The real mystery is why they waited until now to deploy a verison with known bugs. The fix was stable two weeks ago!

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

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
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews