brouznouf / fivem-mysql-async

MySql Async Library for FiveM
MIT License
111 stars 106 forks source link

Not working on 3071 fx-version (Linux & Windows) #151

Open pitermcflebor opened 4 years ago

pitermcflebor commented 4 years ago

Describe the bug

Using Windows: Every query that uses SELECT * doesn't return anything, just an empty table. You need to select each column to not get an empty table. There's an error that appears when you run the server, a JS error. (described below) This only happens on some scripts, i don't find the difference

Using Linux (CentOS7): Every query returns a NULL result. Getting this error everywhere:

[MySQL] [WARNING] [es_extended] [30028ms] SELECT * FROM jobs : []
[MySQL] [ERROR] [es_extended] An error happens for query "SELECT * FROM jobs : []": read ECONNRESET
Uncaught TypeError: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type number
internal/errors.js(216,9): NodeError
buffer.js(293,9): from
@mysql-async/mysql-async.js(2033,29): Auth.token
@mysql-async/mysql-async.js(14096,14): Handshake._sendCredentials
@mysql-async/mysql-async.js(14078,10): Handshake.HandshakeInitializationPacket
@mysql-async/mysql-async.js(6904,23): Protocol._parsePacket
@mysql-async/mysql-async.js(7515,10): _parsePacket
@mysql-async/mysql-async.js(7125,10): write
@mysql-async/mysql-async.js(6651,16): Protocol.write
@mysql-async/mysql-async.js(936,28): 

Expected behavior

Not getting an empty table when fetching all data.

Screenshots / Logs

Error on server console:

Uncaught TypeError: Cannot read property '0' of null
@mysql-async/mysql-async.js(15000,35): typeCast
@mysql-async/mysql-async.js(10625,24): parse
@mysql-async/mysql-async.js(2290,10): Query.RowDataPacket
@mysql-async/mysql-async.js(6323,14): Protocol._parsePacket
@mysql-async/mysql-async.js(6965,10): _parsePacket
@mysql-async/mysql-async.js(6575,10): write
@mysql-async/mysql-async.js(6101,16): Protocol.write
@mysql-async/mysql-async.js(683,28): 
@mysql-async/mysql-async.js(1117,10): 
events.js(210,5): emit

TypeError: Cannot read property '0' of null

Software:

Additional info

This was working correctly on previous versions of fx-server 29XX.

SERBice commented 3 years ago

The same happens to me. I have detected that it does not always happen, in my case I think it is related to the MySQL configuration, and how the users are created, since it does not happen to me with all the users I have, but with some.

I use MySQL 8.0.x (Yes, I know it is not the best, but it is a test environment), my FX Server version is 3302 and the users create them in the following way:

CREATE USER 'USER' @ '%' IDENTIFIED WITH mysql_native_password BY 'PASSWORD';
GRANT ALL PRIVILEGES ON *. * TO 'USER' @ '%';
FLUSH PRIVILEGES;