rodrigogs / mysql-events

A node package that watches a MySQL database and runs callbacks on matched events.
BSD 3-Clause "New" or "Revised" License
136 stars 52 forks source link

TypeError [ERR_UNKNOWN_ENCODING]: Unknown encoding: utf8mb3 #45

Open Athu135 opened 1 year ago

Athu135 commented 1 year ago

TypeError [ERR_UNKNOWN_ENCODING]: Unknown encoding: utf8mb3 at stringSlice (buffer.js:630:9) at Uint8Array.toString (buffer.js:666:10) at Parser.parseString (/var/www/api/kameazy/realtime/node_modules/mysql/lib/protocol/Parser.js:281:28) at Object.exports.readMysqlValue (/var/www/api/kameazy/realtime/node_modules/@rodrigogs/zongji/lib/common.js:446:25) at readRow (/var/www/api/kameazy/realtime/node_modules/@rodrigogs/zongji/lib/rows_event.js:111:16) at UpdateRows._fetchOneRow (/var/www/api/kameazy/realtime/node_modules/@rodrigogs/zongji/lib/rows_event.js:143:13) at UpdateRows.RowsEvent (/var/www/api/kameazy/realtime/node_modules/@rodrigogs/zongji/lib/rows_event.js:62:27) at new UpdateRows (/var/www/api/kameazy/realtime/node_modules/@rodrigogs/zongji/lib/rows_event.js:135:13) at BinlogHeader.parse (/var/www/api/kameazy/realtime/node_modules/@rodrigogs/zongji/lib/packet/binlog_header.js:47:23) at Protocol._parsePacket (/var/www/api/kameazy/realtime/node_modules/mysql/lib/protocol/Protocol.js:272:12) { Error: Packets out of order. Got: 178 Expected: 7 at Parser._tryReadPacketHeader (/var/www/api/kameazy/realtime/node_modules/mysql/lib/protocol/Parser.js:470:15) at Parser.write (/var/www/api/kameazy/realtime/node_modules/mysql/lib/protocol/Parser.js:33:29) at process._tickCallback (internal/process/next_tick.js:61:11)

at Protocol._enqueue (/var/www/api/kameazy/realtime/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Immediate._start (/var/www/api/kameazy/realtime/node_modules/@rodrigogs/zongji/index.js:240:31)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5) code: 'PROTOCOL_PACKETS_OUT_OF_ORDER', fatal: true }
sfabara commented 1 year ago

I am getting the same problem after we updated our MySQL server from version 7 to version 8.0.29. Both packets out of order error and the unknown encoding: utf8mb3. Not sure what direction to take with solving this.

sfabara commented 1 year ago

@Athu135 Hello i found a small go around for this problem. Requires edit to the @rodrigogs/zongii/lib/common.js file. Im creating a pull request now for the fix.

Athu135 commented 1 year ago

@sfabara Hello listening to this gives a relieve. Could please let me know on how to do it. It would be of great help.

sfabara commented 1 year ago

@Athu135 https://github.com/sfabara/zongji I forked the zongji repo and added the fix - if you want to see for yourself it was just a change a change on lines:

Ludovic-LABORDE commented 6 months ago

@sfabara It work for me, thanks !

seanodotcom commented 5 months ago

@Athu135 https://github.com/sfabara/zongji I forked the zongji repo and added the fix - if you want to see for yourself it was just a change a change on lines:

  • 443
  • 466 of @sfabara/zongii/lib/common.js file.

Excellent, thank you! I was wondering if I'd have to change the collation in every database & every table on my server just to watch the MySQL binlog... with this fix, I do not!