Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ER_TOO_LONG_IDENT #1823

Open
lukszy opened this issue Feb 1, 2023 · 4 comments
Open

ER_TOO_LONG_IDENT #1823

lukszy opened this issue Feb 1, 2023 · 4 comments

Comments

@lukszy
Copy link

lukszy commented Feb 1, 2023

Hi there,
i'm using the latest version 3.1.0 of mysql2 and i'm running into issue at db connect.
Provided the host, username, pass and db name - when combined it returns long uri string (94chars) which mysql2 says it's too long to him

  code: 'ER_TOO_LONG_IDENT',
  errno: 1059,
  sqlState: '42000',
  sqlMessage: "Identifier name 'mysql://user_name_here:xxxxxxxxxxxxxxxxx@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/db is too long",
  sql: undefined

Running the connection via mysql client works fine.

is there anyway to configure or fix that?

@sidorares
Copy link
Owner

Are you sure the error comes from initial handshake and not from one of the queries? Can you try to connect with debug: true flag?

@lukszy
Copy link
Author

lukszy commented Feb 2, 2023

Here's the log with debug On

...
     at Connection.handlePacket (/home/username/project1/node_modules/mysql2/lib/connection.js:458:17)
    at PacketParser.onPacket (/home/username/project1/node_modules/mysql2/lib/connection.js:94:12)
    at PacketParser.executeStart (/home/username/project1/node_modules/mysql2/lib/packet_parser.js:75:16)
    at Socket.<anonymous> (/home/username/project1/node_modules/mysql2/lib/connection.js:101:25)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
0 18105 ==> ClientHandshake#unknown name(5,Error,143)
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: Identifier name 'mysql://xxxusernamexxx:xxxxxpasswordxxx@xxxxhostnamexxxxxxxxxx/dbxxxnamexx' is too long
    at Packet.asError (/home/username/project1/node_modules/mysql2/lib/packets/packet.js:728:17)
    at ClientHandshake.execute (/home/username/project1/node_modules/mysql2/lib/commands/command.js:29:26)
    at Connection.handlePacket (/home/username/project1/node_modules/mysql2/lib/connection.js:487:32)
    at PacketParser.onPacket (/home/username/project1/node_modules/mysql2/lib/connection.js:94:12)
    at PacketParser.executeStart (/home/username/project1/node_modules/mysql2/lib/packet_parser.js:75:16)
    at Socket.<anonymous> (/home/username/project1/node_modules/mysql2/lib/connection.js:101:25)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
Emitted 'error' event on Connection instance at:
    at Connection._notifyError (/home/username/project1/node_modules/mysql2/lib/connection.js:249:12)
    at ClientHandshake.<anonymous> (/home/username/project1/node_modules/mysql2/lib/connection.js:138:14)
    at ClientHandshake.emit (node:events:525:35)
    at ClientHandshake.execute (/home/username/project1/node_modules/mysql2/lib/commands/command.js:39:14)
    at Connection.handlePacket (/home/username/project1/node_modules/mysql2/lib/connection.js:487:32)
    [... lines matching original stack trace ...]
    at addChunk (node:internal/streams/readable:324:12) {
  code: 'ER_TOO_LONG_IDENT',
  errno: 1059,
  sqlState: '42000',
  sqlMessage: "***REDACTED***' is too long",
  sql: undefined

I'm confused whether this is libs error or it's just bypassing it from the MySQL server ?

@sidorares
Copy link
Owner

Looks like its coming from the server
I'm confused why the whole URI is sent

btw you forgot to redact uri in one of the lines, consider password compromised - if there is anything sensitive worth updating. I redacted it in your comment but it was visible for ~30 minutes

@sidorares
Copy link
Owner

your issue might be related to #1621

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants