我们正在尝试从一个环境迁移到另一个环境,但是似乎在使用同一数据库时,我们会收到此错误。
我们正在使用无服务器框架,node.js和npm来运行它。我们已经尝试确定机器是否可以正确连接到数据库,并且可以,但是我们也尝试为config.js指定collateOptions,但仍然无法正常工作。
Error: Encoding not recognized: 'undefined' (searched as: 'undefined')
at Object.getCodec (/home/ec2-user/environment/repositories/bbapp-backend/node_modules/mysql2/node_modules/iconv-lite/lib/index.js:106:23)
at Object.getDecoder (/home/ec2-user/environment/repositories/bbapp-backend/node_modules/mysql2/node_modules/iconv-lite/lib/index.js:127:23)
at Object.exports.decode (/home/ec2-user/environment/repositories/bbapp-backend/node_modules/mysql2/lib/parsers/string.js:9:23)
at Packet.readLengthCodedString (/home/ec2-user/environment/repositories/bbapp-backend/node_modules/mysql2/lib/packets/packet.js:355:23)
at new ResultSetHeader (/home/ec2-user/environment/repositories/bbapp-backend/node_modules/mysql2/lib/packets/resultset_header.js:46:24)
at Query.resultsetHeader (/home/ec2-user/environment/repositories/bbapp-backend/node_modules/mysql2/lib/commands/query.js:93:12)
at Query.Command.execute (/home/ec2-user/environment/repositories/bbapp-backend/node_modules/mysql2/lib/commands/command.js:40:20)
at Connection.handlePacket (/home/ec2-user/environment/repositories/bbapp-backend/node_modules/mysql2/lib/connection.js:515:28)
at PacketParser.onPacket (/home/ec2-user/environment/repositories/bbapp-backend/node_modules/mysql2/lib/connection.js:94:16)
at PacketParser.executeStart (/home/ec2-user/environment/repositories/bbapp-backend/node_modules/mysql2/lib/packet_parser.js:77:14)
at Socket.<anonymous> (/home/ec2-user/environment/repositories/bbapp-backend/node_modules/mysql2/lib/connection.js:102:29)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)