TypeError: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object
KrunchMuffin opened this issue · comments
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
- Node version (
node -v
):v18.20.2 - npm version (
npm -v
):10.5.2 - Latitude CLI version (
latitude --version
):latitude, 1.0.1 - Latitude project version (check
latitude.json
at the root of your project):1.0.1 - OS: windows 11
- Browser: n/a
- Database: mysql 8
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
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