rethinkdb / rethinkdb-lua

ReQL driver for Lua
Other
3 stars 1 forks source link

Unable To Authenticate Using Lua Driver On Win10 #5

Open kklouzal opened 7 years ago

kklouzal commented 7 years ago

I'm attempting to use the following Lua based driver on Windows 10 and am unable to authenticate using the default admin account or any secondary accounts with RethinkDB returning a constant error code 12.

Lua Driver: https://github.com/DannehSC/luvit-reql

The following error is returned no matter what we attempt: 2017-10-25 14:31:18 | [INFO] | Connecting to 127.0.0.1:28015 { error = 'Wrong password', error_code = 12, success = false } 2017-10-25 14:31:18 | [FAIL] | ReqlError/ReqlDriverError/ReqlAuthError || Error: Wrong password

To connect is very simple: local luvitReQL=require('luvit-reql') luvitReQL.connect({['username']='testuser',['password']='testpass'}) or local luvitReQL=require('luvit-reql') luvitReQL.connect() Which attempts to authenticate with the default user/pass admin/(blank) Even manually passing the blank password fails local luvitReQL=require('luvit-reql') luvitReQL.connect({['username']='admin',['password']=''})

What's going on here? Bug with the windows version of RethinkDB during the authentication handshake?

I have deleted RethinkDB and redownloaded the zip file. This ensures a 100% vanilla 'install' but to no avail.

Thank you all for your time!

srh commented 7 years ago

Hey @kklouzal. Are other client libraries like Python or JavaScript also unable to connect?

DannehSC commented 7 years ago

As the developer of the library, I'd like to include the fact that I can connect both on my windows 10 machine, as well as my linux server, with no difficulties.

kklouzal commented 7 years ago

I apologize but I do not have an environment to test anything else. I can go ahead and set one up if anyone has a guide to follow.

srh commented 7 years ago

It would probably suffice to see if connecting as done in the Python guide works.

DannehSC commented 7 years ago

It appears I may have had a corrupted installation or something? Because I did a fresh install, and I came across the same problem as @kklouzal.. So I'll be seeing if I can fix that. Sorry for bothering.

DannehSC commented 7 years ago

Update. The node driver fails to connect with the same issue as my driver. It appears the windows zip installation is broken.

JohnnyMorganz commented 7 years ago

Can confirm, tried using the JavaScript driver with default user and password as follows:

const r = require('rethinkdb');
r.connect({host: 'localhost', port: 28015}), function(err, conn) {
  if (err) throw err;
  console.log('connected')
}

Failed with Unhandled rejection ReqlAuthError: Wrong password Rethinkdb Version 2.3.6-windows

DannehSC commented 7 years ago

The python driver appears to work. Yet node and mine do not.

bchavez commented 7 years ago

FWIW, bchavez/C# driver works fine on Windows 10...

C:\temp\rethinkdb-2.3.6>dotnet new console
The template "Console Application" was created successfully.

C:\temp\rethinkdb-2.3.6>dotnet add package RethinkDb.Driver
  info : Adding PackageReference for package 'RethinkDb.Driver' into project 
  info : Package 'RethinkDb.Driver' is compatible with all the specified frameworks in project 

C:\temp\rethinkdb-2.3.6>notepad Program.cs

using System;

namespace rethinkdb_2._3._6
{
  class Program
  {
    static void Main(string[] args)
    {
      var R = RethinkDb.Driver.RethinkDB.R;

      var conn= R.Connection()
                 .Hostname("localhost")
                 .Connect();

      var time = R.Now().Run<DateTimeOffset>(conn);

      Console.WriteLine(time);
    }
  }
}

C:\temp\rethinkdb-2.3.6>dotnet run
10/30/2017 9:38:19 AM +00:00

:dizzy: :boom: Chaos Chaos - Do You Feel It?

DannehSC commented 7 years ago

Strange..

kklouzal commented 7 years ago

Can a developer shed light on if something in the handshake process has changed in recent releases? And old version of Rethink worked but the latest one does not. I would again like to reiterate that the rethink.zip was downloaded and rethink.exe was ran with no launch options or configuration changes.

srh commented 7 years ago

The node driver should work (but it doesn't on Windows, apparently), so I'm going to look into this tonight.

DannehSC commented 7 years ago

If it is a problem with my driver, I'll get working on a fix for that. Dunno why one installation of rethink with the same version works with my driver, but the newest does not. shrug

srh commented 7 years ago

@DannehSC What was the old version of the Windows release that did work?

DannehSC commented 7 years ago

Not sure what this will tell you, but here's the Running lines.


Running rethinkdb 2.3.6-windows (MSC 190024215)...
Running on 6.2.9200 (Windows 8, Server 2012)
DannehSC commented 7 years ago

This.. This makes no sense.. I compared the version it works on, and the version it doesn't work on, the versions, the running lines, everything is the same.

DannehSC commented 7 years ago

Sorry for the bump if you're busy, but.. Bump. @srh

srh commented 7 years ago

Yeah, I got busy, but I'm working on it tonight. Actually the first thing I'm doing is seeing about making Windows building work for people with VS 2017 installed.

DannehSC commented 7 years ago

Okay. Sorry to bother. Just wanted to make sure it wasn't forgotten.

bchavez commented 7 years ago

@DannehSC are you getting the same Wrong password error as @JohnnyMorganz ?


@kklouzal , have you tried using https://github.com/grandquista/Lua-ReQL? Do you get the same error?


I tried the NodeJS driver and seems to work fine on node (v8.8.1 & v7.6.0):

const r = require('rethinkdb');

r.connect({ host: 'localhost', port: 28015}, function(err, conn) {
   r.now().run(conn, function(err2, result){
     console.log(result);
   });
});
C:\temp\rethinkdb-2.3.6>node test.js
2017-11-05T23:59:34.269Z

Also might be helpful if someone could post a working Lua example of some code that has the problem.

DannehSC commented 7 years ago

The lua reql driver does not work with the luvit library (still lua). And luarocks is basically linux only. So it's hard to test it. And kklouzal is running the FCU (fall creators update) but I am not. And here's an example.


local reql=require("luvit-reql")
reql.connect(options)
srh commented 7 years ago

Things work for me with: the npm package I get from the npm repo:

>npm install rethinkdb
rethinkdb@2.3.3 node_modules\rethinkdb
└── bluebird@2.11.0

And the Rethinkdb 2.3.6 Windows binary:

Running rethinkdb 2.3.6-windows (MSC 190024215)...
Running on 6.1.7601 (Windows 7, Server 2008 R2)

Edit: This is while connecting with a username and password.

bchavez commented 7 years ago

@DannehSC It would be really helpful if you could put together a .zip file of a Lua sample project that we could just unzip and run.

If you can, the sample should 1) connect, and 2) attempt to execute a simple r.now() query and 3) print the result to the console.

I don't have any experience with Lua, so I'm stumbling just to get something functional to test.

Thanks,

DannehSC commented 7 years ago

Alright. I'll get to that tomorrow.

bchavez commented 7 years ago

FWIW, tested https://github.com/grandquista/Lua-ReQL and it works. From Linux Lua Client to Windows 10 RethinkDB Server:

test.lua

local r = require'rethinkdb'

local conn, err = r.connect'192.168.0.171'

local result = r.reql(1).add(1).run(conn)

for i, row in result.each() do
  print(row)
end
root@dev1:~/test# lua test.lua
2
bchavez commented 7 years ago

No worries @DannehSC , after a small fight with Lua, was able to get some communications going from your luvit-reql driver. I'm able to reproduce the issue with your driver from a Windows 7 Lua client to a Window 10 RethinkDB server.

I have a small inkling that this is not a problem with Windows 10 or RethinkDB server but perhaps more of an issue with your authentication handshake. Here's a wire-dump of the communication between your Lua driver fail.txt compared to grandquista success-grand.txt:

tortoisegitmerge_782

The failure step looks like it starts around here:

https://github.com/DannehSC/luvit-reql/blob/c1f9d3eb6a01a0e76a6d0872e28e8f36567aa16c/libs/connect.lua#L82

and compared to grandquista:

https://github.com/grandquista/Lua-ReQL/blob/231b948c49d45019e9b941d6831e656926b57030/src/rethinkdb/internal/current_handshake.lua#L181

Suggestions:

It only takes one bit flipped somewhere to throw everything off. :crying_cat_face:

Hope that helps.

DannehSC commented 7 years ago

Alright! Thank you so much! <3