memgraph / mage

MAGE - Memgraph Advanced Graph Extensions :crystal_ball:
Apache License 2.0
240 stars 23 forks source link

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

Closed ccueto36 closed 3 months ago

ccueto36 commented 8 months ago

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);
Josipmrden commented 8 months ago

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

antejavor commented 8 months ago

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

antepusic commented 7 months ago

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

katarinasupe commented 3 months ago

@Josipmrden can this be closed now?

katarinasupe commented 3 months ago

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.