rschooley

rschooley

How can I debug issues using an erlang lib?

I am trying out rabbit streams but am having some issues using the Lake library.

I am getting a malformed error from inside the library:

[error] GenServer #PID<0.656.0> terminating
** (CaseClauseError) no case clause matching: {:error, {:malformed, <<65, 77, 81, 80, 0, 0, 9, 1>>}}
    (lake 0.1.2) /Users/me/projects/my-app/deps/lake/src/lake_raw_connection.erl:36: :lake_raw_connection.peer_properties/1
    (lake 0.1.2) /Users/me/projects/my-app/deps/lake/src/lake_raw_connection.erl:24: :lake_raw_connection.connect1/6
    (lake 0.1.2) /Users/me/projects/my-app/deps/lake/src/lake_raw_connection.erl:9: :lake_raw_connection.connect/6
    (lake 0.1.2) /Users/me/projects/my-app/deps/lake/src/lake_connection.erl:35: :lake_connection.connect/6
...

How do I decode this value to debug the issue? The value doesn’t look particularly long, is this even a useful error message? Is there another way I can troubleshoot this issue?

Calling code for background:

    result = :lake.connect(
      'localhost',
      5672,
      'guest',
      'guest',
      '/'
    )

I thought it might be an issue passing binaries/strings instead of char lists, but have tried <<"localhost">>, 'localhost', String.to_charlist("localhost"), etc but the called function arguments match so I don’t think it is that.

Marked As Solved

derek-zhou

derek-zhou

Look at the source. It says it received some data it cannot recognize. Are you sure you are using the right port (5672)?

Google tells me that 5672 is the RabbitMQ port and 5552 is the RabbitMQ Streaming port

Also Liked

al2o3cr

al2o3cr

This is the four characters AMQP followed by a version number - it’s the header from AMQP v0.9.1; that’s not the protocol that lake wants to speak.

+1 for @derek-zhou’s suggestion that the wrong port is being used.

Where Next?

Popular in Questions Top

9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
beno
I will often find my self writing things similar to: case some_value do nil -&gt; something() "" -&gt; something() _ -&gt; somethi...
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
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
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
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New

Other popular topics Top

mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
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
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
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
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Qqwy
Update: How to use the Blogs &amp; Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 127536 1222
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
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 54250 245
New

We're in Beta

About us Mission Statement