mage icon indicating copy to clipboard operation
mage copied to clipboard

[BUG] `periodic.iterate` does not use authentication even when environmental variables are set

Open ccueto36 opened this issue 1 year ago • 3 comments

Describe the bug While having authentication enabled in Memgraph, query modules such as periodic.iterate return a connection error upon trying to be used.

To Reproduce Steps to reproduce the behavior:

  1. Enable authentication in memgraph
  2. Attempt to run a module such as periodic.iterate
  3. See error returned

Expected behavior Query modules should pass authentication username and password respectively when connecting to memgraph via their respective client libraries.

Screenshots

[2023-11-01 16:33:13.617][Info]Accepted a connection from Bolt: 127.0.0.1:50844
[2023-11-01 16:33:13.617][Info]Using version 4.1 of protocol
[2023-11-01 16:33:13.618][Info]Client connected 'mgclient++/1.4.1'
[2023-11-01 16:33:13.618][Warning]Couldn't authenticate user '' because the user doesn't exist. For more details, visit https://memgr.ph/auth.
[2023-11-01 16:33:13.618][Info]Bolt client 127.0.0.1:50844 closed the connection.
[2023-11-01 16:33:14.001][Error]Session error: Connection reset by peer
[2023-11-01 16:33:14.001][Error]Session shutdown failed: Transport endpoint is not connected [system:107]
[2023-11-01 16:33:14.001][Trace]Error message: periodic.iterate: Unable to connect to client!
[2023-11-01 16:33:14.002][Trace]Reset received

Additional context Upon seeing the ExecuteRunningQuery method in periodic_iterate.cpp module file, no authentication parameters are passed to the connection:

mg::Client::Params session_params{.host = "localhost", .port = 7687};
  auto client = mg::Client::Connect(session_params);

ccueto36 avatar Nov 01 '23 20:11 ccueto36

@ccueto36 added a PR which should fix this https://github.com/memgraph/mage/pull/407

Josipmrden avatar Nov 01 '23 20:11 Josipmrden

I have provided a prebuilt version of the module based on this PR to @ccueto36 on Discord.

antejavor avatar Nov 03 '23 13:11 antejavor

Hi @ccueto36! Did PR #407 succeed in resolving this issue?

antepusic avatar Nov 30 '23 13:11 antepusic

@Josipmrden can this be closed now?

katarinasupe avatar Apr 11 '24 10:04 katarinasupe

I tested periodic.iterate() with auth on and it works as expected. I am closing this issue and adding it to MAGE 1.16 milestone. @ccueto36 please report if the latest release did not resolve your issue.

katarinasupe avatar Apr 12 '24 09:04 katarinasupe