latitude-dev / latitude

Developer-first embedded analytics
https://latitude.so
GNU Lesser General Public License v3.0
626 stars 21 forks source link

TypeError: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object #327

Closed KrunchMuffin closed 3 weeks ago

KrunchMuffin commented 3 weeks ago

Steps To Reproduce

follow wsl directions have mysql on local machine set datasource to use local machine ip create a test query run test query in cli select count(*) from user where active =1

Environment

Expected Behavior

expect sql result to show in cli

Actual Behaviour

d@D-DEKSTOP:~/latitude/test$ latitude run test2

> @latitude-data/server@1.0.1 query
> vite-node scripts/run_query/index.ts test2 {} false false

TypeError: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received type number (412)
    at new NodeError (node:internal/errors:405:5)
    at Function.from (node:buffer:325:9)
    at Object.Auth.token (/home/d/latitude/test/node_modules/mysql/lib/protocol/Auth.js:41:29)
    at Handshake._sendCredentials (/home/d/latitude/test/node_modules/mysql/lib/protocol/sequences/Handshake.js:98:14)
    at Handshake.HandshakeInitializationPacket (/home/d/latitude/test/node_modules/mysql/lib/protocol/sequences/Handshake.js:80:10)
    at Protocol._parsePacket (/home/d/latitude/test/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/home/d/latitude/test/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/home/d/latitude/test/node_modules/mysql/lib/protocol/Parser.js:43:10)
    at Protocol.write (/home/d/latitude/test/node_modules/mysql/lib/protocol/Protocol.js:38:16)
    at Socket.<anonymous> (/home/d/latitude/test/node_modules/mysql/lib/Connection.js:88:28)

Workarounds

N/A

KrunchMuffin commented 3 weeks ago

Sort of worked it out. My local mysql pwd is just a number and starts with a 0. So I wrapped it in single quotes then I get this message about it not supporting the new pwd encryption in mysql8. Assuming so anyway.

If the connector is using mysql, should update to mysql2

ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider ││upgrading MySQL client

andresgutgon commented 3 weeks ago

Yes, thanks for reporting. We have already an issue open for moving to mysql2 https://github.com/latitude-dev/latitude/issues/173

geclos commented 3 weeks ago

closing because of duplicate of #173