florinpatrascu / bolt_sips

Neo4j driver for Elixir
Apache License 2.0
256 stars 49 forks source link

Query failed #37

Closed sweco-semtne closed 6 years ago

sweco-semtne commented 6 years ago

Hi Florin, I would like to thank you for a great library! But, I'm having troubles running through the example in the readme.

I get this match error: "no function clause matching in :gen_tcp.send/2"

I'm using Erlang 20 and Elixir 1.5.2 and Bolt 0.4.11 (latest from Hex)

Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> {:ok, pid} = Bolt.Sips.start_link(url: "localhost")
{:ok, #PID<0.5408.0>}
iex(2)> conn = Bolt.Sips.conn
{:ok, %{"server" => "Neo4j/3.1.0"}}
iex(3)> Bolt.Sips.query!(conn, "CREATE (a:Person {name:'Bob'})")
** (exit) exited in: :gen_server.call(#PID<0.5415.0>, {{:ok, %{"server" => "Neo4j/3.1.0"}}, "CREATE (a:Person {name:'Bob'})", %{}}, 15000)
    ** (EXIT) an exception was raised:
        ** (FunctionClauseError) no function clause matching in :gen_tcp.send/2
            (kernel) gen_tcp.erl:265: :gen_tcp.send({:ok, %{"server" => "Neo4j/3.1.0"}}, <<0, 2, 176, 14, 0, 0>>)
            (elixir) lib/enum.ex:675: Enum."-each/2-lists^foreach/1-0-"/2
            (elixir) lib/enum.ex:675: Enum.each/2
            (boltex) lib/boltex/bolt.ex:209: Boltex.Bolt.ack_failure/3
            (bolt_sips) lib/bolt_sips/connection.ex:65: anonymous fn/3 in Bolt.Sips.Connection.handle_call/3
            (elixir) lib/enum.ex:3176: Enumerable.List.reduce/3
            (elixir) lib/stream.ex:849: Stream.do_list_transform/10
            (elixir) lib/enum.ex:1887: Enum.reduce_while/3
            (bolt_sips) lib/bolt_sips/connection.ex:57: Bolt.Sips.Connection.handle_call/3
            (stdlib) gen_server.erl:636: :gen_server.try_handle_call/4
            (stdlib) gen_server.erl:665: :gen_server.handle_msg/6
            (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
    (stdlib) gen_server.erl:214: :gen_server.call/3
    (poolboy) /Users/semtne/Projects/xxx/deps/poolboy/src/poolboy.erl:76: :poolboy.transaction/3
    (bolt_sips) lib/bolt_sips/query.ex:80: Bolt.Sips.Query.tx/3
    (bolt_sips) lib/bolt_sips/query.ex:55: Bolt.Sips.Query.query!/3
iex(3)> [error] GenServer #PID<0.5415.0> terminating
** (FunctionClauseError) no function clause matching in :gen_tcp.send/2
    (kernel) gen_tcp.erl:265: :gen_tcp.send({:ok, %{"server" => "Neo4j/3.1.0"}}, <<0, 2, 176, 14, 0, 0>>)
    (elixir) lib/enum.ex:675: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:675: Enum.each/2
    (boltex) lib/boltex/bolt.ex:209: Boltex.Bolt.ack_failure/3
    (bolt_sips) lib/bolt_sips/connection.ex:65: anonymous fn/3 in Bolt.Sips.Connection.handle_call/3
    (elixir) lib/enum.ex:3176: Enumerable.List.reduce/3
    (elixir) lib/stream.ex:849: Stream.do_list_transform/10
    (elixir) lib/enum.ex:1887: Enum.reduce_while/3
    (bolt_sips) lib/bolt_sips/connection.ex:57: Bolt.Sips.Connection.handle_call/3
    (stdlib) gen_server.erl:636: :gen_server.try_handle_call/4
    (stdlib) gen_server.erl:665: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.5406.0>): {{:ok, %{"server" => "Neo4j/3.1.0"}}, "CREATE (a:Person {name:'Bob'})", %{}}
State: [auth: {}, socket: :gen_tcp, hostname: 'localhost', retry_linear_backoff: [delay: 150, factor: 2, tries: 3], with_etls: false, ssl: false, timeout: 15000, max_overflow: 2, pool_size: 5, port: 7687, url: "localhost"]
Client #PID<0.5406.0> is alive
    (stdlib) gen.erl:169: :gen.do_call/4
    (stdlib) gen_server.erl:210: :gen_server.call/3
    (poolboy) /Users/semtne/Projects/xxx/deps/poolboy/src/poolboy.erl:76: :poolboy.transaction/3
    (bolt_sips) lib/bolt_sips/query.ex:80: Bolt.Sips.Query.tx/3
    (bolt_sips) lib/bolt_sips/query.ex:55: Bolt.Sips.Query.query!/3
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
    (elixir) src/elixir.erl:239: :elixir.eval_forms/4
    (iex) lib/iex/evaluator.ex:231: IEx.Evaluator.handle_eval/5
    (iex) lib/iex/evaluator.ex:212: IEx.Evaluator.do_eval/3
    (iex) lib/iex/evaluator.ex:190: IEx.Evaluator.eval/3
    (iex) lib/iex/evaluator.ex:89: IEx.Evaluator.loop/1
    (iex) lib/iex/evaluator.ex:24: IEx.Evaluator.init/4
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
florinpatrascu commented 6 years ago

Thank you so much for trying our driver. And I apologize for the issue. We’re between versions and there are few caveats which are now affecting your deployment. Can you use bolt_sips, from master?! If not, then use it from hexpm but please move the boltex dep one version down, in your dependencies I will post a fix as soon as possible. Please let me know how it goes.

sweco-semtne commented 6 years ago

No need to apologize. Keep up the good work! How can I use the master version? Point at git in mix.exs? {:bolt, git: "https://github.com/florinpatrascu/bolt_sips.git"}

Unchecked dependencies for environment dev:
* bolt (https://github.com/florinpatrascu/bolt_sips.git)
  could not find an app file at "_build/dev/lib/bolt/ebin/bolt.app". This may happen if the dependency was not yet compiled, or you specified the wrong application name in your deps, or the dependency indeed has no app file (then you can pass app: false as option)
** (Mix) Can't continue due to errors on dependencies

Update: I works better if you call the application by its correct name :bolt_sips ... Having done that I can build it :-)

Running with the example readme I get this from master.

{:ok, pid} = Bolt.Sips.start_link(url: "localhost")
[error] GenServer #PID<0.1585.0> terminating
** (WithClauseError) no with clause matching: {:ok, %{"server" => "Neo4j/3.3.1"}}
    (bolt_sips) lib/bolt_sips/protocol.ex:28: Bolt.Sips.Protocol.connect/1
    (db_connection) lib/db_connection/connection.ex:134: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: nil
florinpatrascu commented 6 years ago

Hi Mats,

It's as simple as adding this: {:bolt_sips, github: "florinpatrascu/bolt_sips"}, to your dependencies, in the mix.exs.

HTH Florin

leveloid commented 6 years ago

I'm seeing the same:

[error] GenServer #PID<0.2662.0> terminating
** (WithClauseError) no with clause matching: {:ok, %{"server" => "Neo4j/3.2.7"}}
    (bolt_sips) lib/bolt_sips/protocol.ex:28: Bolt.Sips.Protocol.connect/1
    (db_connection) lib/db_connection/connection.ex:134: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: nil
State: Bolt.Sips.Protocol

with these in my mix.exs:

{:bolt_sips, github: "florinpatrascu/bolt_sips"},
{:db_connection, github: "elixir-ecto/db_connection", override: true}
florinpatrascu commented 6 years ago

sorry, my fault again. Please use everything from hex.pm. I just published a maintenance release for Bolt.Sips; v0.4.12, here: {:bolt_sips, "~> 0.4.12"}

florinpatrascu commented 6 years ago

any feedback for this issue?

sweco-semtne commented 6 years ago

Hi Florin, 0.4.12 works great for me. Thank you!

florinpatrascu commented 6 years ago

Awesome! Thank you for the feedback!

caldempsey commented 6 years ago

Working now :) +1

florinpatrascu commented 6 years ago

@mmacheerpuppy - glad the mystery is solved :) However, you should probably use the master version from now on, as we committed a bunch of bug fixes and improvements lately. HTH, and let us know how it goes :)

caldempsey commented 5 years ago

Hey florin thank you so much. Had a few drinks at the bar but I'd like to extend my love and respect to you and your team. Buy everyone coffee on me! Cheers!

florinpatrascu commented 5 years ago

Haha thank you! ❤️